Skip to content

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

Merged
merged 1 commit into from
Aug 1, 2016

Conversation

nicoddemus
Copy link
Member

While running regedocs for pytest 3.0 earlier today I noticed that invocation scoped fixtures appear more than once with --fixtures.

@coveralls
Copy link

coveralls commented Aug 1, 2016

Coverage Status

Coverage increased (+0.006%) to 93.083% when pulling 13746b3 on nicoddemus:invocation-fixtures-help into aa145fa on pytest-dev:features.

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:
Copy link
Member

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 :?

Copy link
Member Author

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".

Copy link
Member

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? 😃

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 😁

@nicoddemus nicoddemus force-pushed the invocation-fixtures-help branch from 13746b3 to 44ecf2a Compare August 1, 2016 21:48
@hackebrot
Copy link
Member

Great! Happy to merge once you update the changelog 👍

@coveralls
Copy link

coveralls commented Aug 1, 2016

Coverage Status

Coverage increased (+0.006%) to 93.083% when pulling 44ecf2a on nicoddemus:invocation-fixtures-help into aa145fa on pytest-dev:features.

@nicoddemus
Copy link
Member Author

I don't think it is necessary to update the changelog, after all invocation-scoped fixtures were not released yet. 😁

@hackebrot
Copy link
Member

You have a point there! 😁 I just noticed that this is going to features branch anyways, which does make sense in hindsight.

@hackebrot hackebrot merged commit 226f279 into pytest-dev:features Aug 1, 2016
@hackebrot
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants