Suppose I have packageA
which provides a class usefulClass
, pytest fixtures in a test_stuff.py
module, and test configurations in a conftest.py
module.
Moreover, suppose that I have packageB
and packageC
both of which import packageA
, installed via pip
, and that they use usefulClass
in the same way. Because they use usefulClass
in the same way, packageB
and packageC
will require many identical pytest fixtures and configurations. In fact, their tests will primarily differ only in the sets of inputs over which they iterate.
Because the fixtures and configurations are identical and arise from the use of usefulClass
, is it possible to define those fixtures and configurations in packageA
, and then import them into the testing environments of packageB
and packageC
?
In particular, I would like to reuse the definition of pytest_generate_tests
that appears in packageA
's conftest.py
module across dozens, if not hundreds of other packages. This way, I only need maintain one confest.py
module, rather than hundreds.