[TIP] Testing dependencies

Alfredo Deza arufuredosan at gmail.com
Sun Sep 6 11:55:31 PDT 2009


Hi,

I am currently working in a small project that has a couple of dependencies.

The problem is I do not need them directly (no need to import them at any
point) because I call those dependencies with subprocess.Popen

My current approach is to try an import anyway and fail with an error
message if it could not import the module:

try:
    import dependency_1
    import dependency_2
except Exception, e:
    print "DependencyError: %s" % e

Is it better to put this within the tests directory along with the other
tests?

Or maybe have them in both places: one in the main source code and the other
one in the tests directory?


Thanks


Alfredo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/testing-in-python/attachments/20090906/8c417ce6/attachment.htm 


More information about the testing-in-python mailing list