Skip to content

[WIP] raise exception when fixture is applied to marked function #4122

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/_pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,8 @@ def pytest_fixture_setup(fixturedef, request):
kwargs[argname] = result

fixturefunc = resolve_fixture_function(fixturedef, request)
if hasattr(fixturefunc,'pytestmark'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid exceptions being eaten on python2, its critical to use getattr(fixturefunc,'pytestmark', False) instead

to be documentative perhaps getattr(fixturefunc,'pytestmark', None) is not None even

fail('nono', pytrace=False)
my_cache_key = request.param_index
try:
result = call_fixture_func(fixturefunc, request, kwargs)
Expand Down