[TIP] network testing complexity

Mark Sienkiewicz sienkiew at stsci.edu
Tue Apr 6 07:21:48 PDT 2010

Alfredo Deza wrote:
> However, I also have specific tests for all the methods/functions involved.
> I had a user complain about the network tests breaking (which is expected if
> he doesn't have a proper setup)

You should make a few tests that check for the proper test environment.  
Then when a correct-environment-test fails, it says "No working test 
environment - see section XXX of the documentation".

This can be a separate test from what uses the test environment, or a 
specific test could look that the necessary environment is working 
before performing the test.  There are advantages/disadvantages to each 

> but I find it very
> useful to have not only tests for methods/functions but also for the final
> output: did the file actually made it?
> Is this approach OK?

It is not only OK, it is a desirable characteristic of a good set of 
tests.  It's hard to beat "produced the correct result" as a criterion 
for your system tests. :)

Mark S.

More information about the testing-in-python mailing list