unittest: Calling tests in liner number order

Ryan Ginstrom software at ginstrom.com
Sun May 25 11:39:29 EDT 2008


> On Behalf Of Roy Smith
> You could have a bunch of tests of increasing complexity.  
> The first bunch of tests all run in a few seconds and test 
> some basic functionality.  From experience, you also know 
> that these are the tests that are most likely to fail as you 
> port to a new environment.
> 
> There's also some tests which take a long time to run.  If 
> the basic stuff that's being tested by the earlier tests 
> doesn't work, there's no way these tests could pass, but they 
> still take a long time to fail.

How about something like this:

def run_quickies():
    # run the quick, i.e. actual unit tests
    # located in folder ./unit_tests/

def run_long_ones():
    # Run function tests, integration tests, what have you
    # located in folder ./integration_tests/

def whole_shebang():
    run_quickies()
    run_long_ones()

Now you do something like run the unit tests every time a file is saved, and
run the whole shebang nightly and every time a build is performed.

Regards,
Ryan Ginstrom




More information about the Python-list mailing list