You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a situation, where I need to run a pytest package (=directory with test_*.py files) with some nonstandard configuration. The point is, that this nonstandard configuration has to look like another pytest package (and this configuration has nothing to do with pytest configuration itself). For example given the structure
I want to run pytest fake_package and get actually real_package executed. (And inbetween I do some tooling changes which are unrelated to pytest).
I have two below ideas about this (looks like both are somewhat working at first shot), but I am looking for some "proper" solution which would avoid any surprises (which also will survive migration from pytest 6 to 7 btw):
just run pytest.main() for real_module from some early hook in fake_module.conftest.py (and make fake_package generally empty otherwise)
modify (recreate? - this seems to be not quite straightforward) Config object in pytest_configure hook in fake_module.conftest.py (like change paths etc.) and let pytest do the rest
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I have a situation, where I need to run a pytest package (=directory with test_*.py files) with some nonstandard configuration. The point is, that this nonstandard configuration has to look like another pytest package (and this configuration has nothing to do with pytest configuration itself). For example given the structure
I want to run
pytest fake_package
and get actuallyreal_package
executed. (And inbetween I do some tooling changes which are unrelated to pytest).I have two below ideas about this (looks like both are somewhat working at first shot), but I am looking for some "proper" solution which would avoid any surprises (which also will survive migration from pytest 6 to 7 btw):
real_module
from some early hook infake_module.conftest.py
(and makefake_package
generally empty otherwise)pytest_configure
hook infake_module.conftest.py
(like change paths etc.) and let pytest do the restWhat is the best way here?
TIA
Beta Was this translation helpful? Give feedback.
All reactions