Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixtures: show test as skip location if skipped from an xunit setup function #11216

Closed
bluetech opened this issue Jul 16, 2023 · 0 comments · Fixed by #11217
Closed

fixtures: show test as skip location if skipped from an xunit setup function #11216

bluetech opened this issue Jul 16, 2023 · 0 comments · Fixed by #11217
Labels
topic: fixtures anything involving fixtures directly or indirectly

Comments

@bluetech
Copy link
Member

PR #10482 made it so that if a fixture calls skip(), the skip location is shown as the test function, not the fixture. But it excluded xunit setup fixtures from this.

I suspect this was done to make a pre-existing test pass, however I think that the same reason for fixtures applies to xunit fixtures just as well, so we shouldn't exclude it.

Would also remove a string-hack that was used to implement this exclusion...

pytest/src/_pytest/fixtures.py

Lines 1162 to 1168 in bf451d4

try:
result = call_fixture_func(fixturefunc, request, kwargs)
except TEST_OUTCOME as e:
if isinstance(e, skip.Exception) and not fixturefunc.__name__.startswith(
"xunit_setup"
):
e._use_item_location = True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: fixtures anything involving fixtures directly or indirectly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant