-
Hi, I'm not sure if this is something I'm doing wrong, a bug or known behaviour in recent versions of pytest, so trying to post here first. When I'm using metafunc.parametrize on session scoped fixtures it causes a teardown after each test function, instead of after the entire session. It doesn't happen in pytest 5.3.5, but does happen in pytest 5.4+ versions (reproduced on 5.4.3 & 6.1.2). Reproduction code example:
Running with: pytest -s --setup-show --config 'path/to/file' Output from pytest version 5.3.5:
Output from pytest versions 5.4.3 & 6.1.2:
Thanks, appreciate the help, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, Following up, I now noticed this seems to happen only when passing mutable objects to metafunc paramertize. If we take my example above and change in pytest_generate_tests confs to: Then it runs properly (same output as 5.3.5 version), but passing mutable object would cause the issue I mentioned. Do you think it's a bug in newer pytest versions (since it worked before), or is it the expected behaviour for mutable object in paramertization and I should change how we load the configuration? Thanks, |
Beta Was this translation helpful? Give feedback.
-
I agree that the pytest 5.3.5 seems like the better one. The mutable thing is very odd. This is probably a bug, I'll try to look into it when I get a chance. I'll open an issue referencing this so we can track it. Edit: #8102 |
Beta Was this translation helpful? Give feedback.
I agree that the pytest 5.3.5 seems like the better one. The mutable thing is very odd. This is probably a bug, I'll try to look into it when I get a chance. I'll open an issue referencing this so we can track it.
Edit: #8102