[TIP] Getting Weird Coverage Reports
memedough at gmail.com
Tue Nov 29 03:51:42 PST 2011
> Right. I am thinking of calling a setup_directory|teardown_directory(X)
> in respective conftest.py files.
> FWIW there were some users on the IRC channels requesting the equivalent
> of nose's setup_package/teardown_package. I'd rather like to use a
> different approach - call setup_directory(testdata) where "testdata"
> is a global object on which you can set attributes. This very object
> can be accessed from test functions as a funcarg:
> def test_function(testdata):
> # access globally shared test resources as attributes on "testdata"
> it probably would also make sense to make the config object available
> to setup_directory so that one can create global resources depending
> on command line options etc. Either as an attribute on testdata or
> as a second argument to the setup/teardown functions.
> Makes sense to you?
Sounds good. When would the setup_directory be called? If there are
tests but filtered with -k such that a directory won't have any tests
run will that avoid the setup_directory / teardown_directory for that
More information about the testing-in-python