-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
invocation-scoped fixtures show up once with --fixtures #1782
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
invocation-scoped fixtures show up once with --fixtures #1782
Conversation
for argname, fixturedefs in fm._arg2fixturedefs.items(): | ||
assert fixturedefs is not None | ||
if not fixturedefs: | ||
continue | ||
for fixturedef in fixturedefs: | ||
loc = getlocation(fixturedef.func, curdir) | ||
fixture_argname = fixturedef.argname | ||
if ':' in fixture_argname: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does fixture_argname
have a :
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it's a invocation-scoped fixture. For example, defining monkeypatch
as invocation-scoped will generate 4 fixture-defs in different scopes: "monkeypatch:function"
, "monkeypatch:class"
, "monkeypatch:module"
and "monkeypatch:session"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Can you please add a comment? 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 😁
13746b3
to
44ecf2a
Compare
Great! Happy to merge once you update the changelog 👍 |
I don't think it is necessary to update the changelog, after all invocation-scoped fixtures were not released yet. 😁 |
You have a point there! 😁 I just noticed that this is going to |
👍 |
While running regedocs for pytest 3.0 earlier today I noticed that invocation scoped fixtures appear more than once with
--fixtures
.