Replies: 1 comment 2 replies
-
Strictly speak its direct parameterization The fixture just takes the same parameter as the test, so it works If parameterization was used, the data would be on request, not a fixture |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One of the projects I work on implements test parametrization in a way I don't see mentioned in the pytest documentation, and I wanted to get some feedback here to make sure I'm not missing something in the documentation where this behavior is discussed, and if there are any potential issues with using parametrization in this way. As mentioned in [1], any parametrization applied to a test will also affect any arguments with the same name on fixtures consumed by the test. You can even pass the
scope
keyword argument topytest.mark.parametrize()
ormetafunc.parametrize()
when doing so, and it will work as expected with fixture scope.Example:
This basic pattern has been used for years by the project I mentioned, and we've never had a problem with this functionality (although I see mention of a temporary removal and then reinstatement of this behavior in [1]).
[1] https://stackoverflow.com/questions/18011902/pass-a-parameter-to-a-fixture-function/60148972#60148972
Beta Was this translation helpful? Give feedback.
All reactions