How to skip package if the fixture for the package fails to initialize data. #9747
Unanswered
sukeshlaghate
asked this question in
Q&A
Replies: 1 comment
-
Hi @sukeshlaghate, Unfortunately seems like a bug related to package scoped fixtures: in your example, they are only being setup once per session, instead of once per package. 😕 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My pyTest suite is organized in following structure
now suppose that fixture data_setup2 fails to initialize data required by all tests contained in package2, then all tests under package2 should be skipped. While all other tests belonging to other packages should run.
What I have tried so far:
Approach 1:
this allows me to collect all fixtures
However, failure in one of the data setup causes all the packages to be skipped. What I would expect is that pytest should skip only those tests that belong to package2
Approach2:
I define fixtures and have check flag returned as part of data_packet and in individual test_pack_2_cycles_*.py I am checking to see if the success flag is present
like so
this allows me to collect all fixtures
2. in data_setup*.py I have defined fixture as
This works as expected, however this approach requires me to write these lines in every test__cycle inside the package. Is there a better approach to skip tests for package where data setup (fixture belonging to particular package) fails?
I would like to implement approach 1 or something similar on that lines and thus avoid having to write pytest.skip in individual *.py files.
Request you to provide how I can achieve this or point me in the right direction.
With regards
Sukesh.
Beta Was this translation helpful? Give feedback.
All reactions