-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 #1711
Invocation scoped fixtures #1711
Conversation
@@ -172,7 +172,7 @@ def capfd(request): | |||
captured output available via ``capfd.readouterr()`` method calls | |||
which return a ``(out, err)`` tuple. | |||
""" | |||
if "capsys" in request._funcargs: | |||
if "capsys" in request.fixturenames: |
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.
note to self: add a test here that this will work when capsys/capfd are requested using request.getfixturevalue()
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
94448a3
to
a001445
Compare
a001445
to
8ed055e
Compare
…alue" inside a test
e206937
to
0dd1c8b
Compare
I think this is ready for reviewing |
FWIW I changed (locally) |
any scope, when they assume the same scope as the fixture requesting it. An ``invocation``-scoped | ||
fixture can be requested from different scopes in the same test session, | ||
in which case each scope will have its own copy. This feature is considered experimental. | ||
Thanks `@nicoddemus`_ for the PR. |
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.
i'd rather write:
Experimentally introduce new "invocation" fixture scope. At invocation scope a fixture function is cached in the same way as the fixture or test function that requests it. You can now use the builtin monkeypatch
fixture from session-scoped fixtures where previously you would get an error that you can not use a function-scoped fixture from a session scoped one.
all looks good. I see you implemented the ":SCOPE" naming idea we discussed after the sprint and it seems to work, great! So just a few more fine grained tests missing and it's ready to merge. thanks for the good work! |
@nicoddemus great job |
Applied the requested changes, I'll merge this myself tomorrow unless someone else does it first or has more comments. 😄 |
Implementation for invocation-scoped fixtures as we discussed during the sprint. There are some things still missing on the PR, but I would like to get feedback from what's implemented so far.
@hpk42 I would appreciate your feedback, as I'm sure you are the most knowledgeable person on the fixture machinery. 😁
TODO:
CHANGELOG