Tests that really depend on each other should be explicitly tied to one test.
Tests that require different settings can also have the appropriate setUp() mode of operation, sufficient for installation - various ways are conceivable.
Otherwise, unittest processes test classes and test methods inside the test classes alphabetically by default (even if loader.sortTestMethodsUsing is None). dir() used internally, which is sorted under warranty.
The latter behavior can be used for practicality - for example. in order to run the most recent working tests in order to speed up the edit-testrun cycle. But this behavior should not be used to establish real dependencies . Please note that tests can be run individually using command line options, etc.
kxr Mar 02 '17 at 18:32 2017-03-02 18:32
source share