[pytest-dev] deprecating `pytest_plugins` in non-initial conftests to prevent unintended smear/spill of plugin configurations

RonnyPfannschmidt opensource at ronnypfannschmidt.de
Wed Oct 25 03:54:56 EDT 2017

hi everyone,

while reviewing the codebase i noticed, that the code that is ensuring
we don't use conftests from other folders don't take into account
`pytest_plugins` declared in such a conftest
thus the plugin system gives a false impression.

intuitively i'd expect plugins listed in a conftest only to be active
when that conftest is active

however due to the way our plugin system works, we only mark conftests
of other folders as "disabled" not their dependencies

i dont see a sane way to implement this feature correctly, as we wouldnt
be allowed to disable a plugin just because its listed in one folder,
after all it may be listed in multiple folders but not one certain folder

the plugin system as we constructed is is not aware of hierarchical
dependencies and i dont think we can get this good/right with the
current development process we use

as such i propose deprecating them and warning users about the problems
with regard to when and how to warn we need to take a look in detail as
there are many reasonably valid setups with exactly one non initial conftest
and we should help people to turn those into initial conftest's while
cleaning out the rest.

-- Ronny

More information about the pytest-dev mailing list