Skip to content
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

[Bug]: Parametrization with Variables Unexpectedly Changes Fixture Scope #12957

Open
cyw233 opened this issue May 23, 2024 · 0 comments
Open

Comments

@cyw233
Copy link
Contributor

cyw233 commented May 23, 2024

Issue Description

As mentioned in pytest-dev/pytest#12146, pytest has a bug that a fixture's scope will get changed when using variables to set argument values in parametrization, causing unexpected fixture setups and teardowns.

We recently ran into this problem when running ACL tests in a multi-dut device (#12715), and later we pushed a fix (#12824) to bypass this issue. However, we have many places in our repo that are also passing variables during parametrization, .e.g, metafunc.parametrize("fixture_name", variables, scope="module"). Therefore, we need to find a way to fix this problem completely.

Results you see

a fixture's scope will get changed when using variables to set argument values in parametrization

Results you expected to see

a fixture's scope won't get changed when using variables to set argument values in parametrization

Is it platform specific

generic

Relevant log output

No response

Output of show version

No response

Attach files (if any)

No response

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

No branches or pull requests

1 participant