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

cases breaks autouse with parametrization #114

Closed
mganisin opened this issue Jul 10, 2020 · 2 comments
Closed

cases breaks autouse with parametrization #114

mganisin opened this issue Jul 10, 2020 · 2 comments

Comments

@mganisin
Copy link

When

$ cat test_this.py
import pytest

@pytest.fixture(autouse=True)
def one():
    pass

@pytest.fixture(params=[1, 2])
def two():
    pass

def test_me(two):
    assert True

then

pytest --setup-show test_this.py
============================================================================ test session starts =============================================================================
platform linux -- Python 3.6.9, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/tmp.avOUzRDAMS
collected 2 items

test_this.py
        SETUP    F one
        SETUP    F two[1]
        test_this.py::test_me[1] (fixtures used: one, two).
        TEARDOWN F two[1]
        TEARDOWN F one
        SETUP    F one
        SETUP    F two[2]
        test_this.py::test_me[2] (fixtures used: one, two).
        TEARDOWN F two[2]
        TEARDOWN F one

============================================================================= 2 passed in 0.01s ==============================================================================

but

pytest --setup-show test_this.py
============================================================================ test session starts =============================================================================
platform linux -- Python 3.6.9, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/tmp.avOUzRDAMS
plugins: cases-2.0.2
collected 2 items

test_this.py
        SETUP    F two[1]
        test_this.py::test_me[1] (fixtures used: two).
        TEARDOWN F two[1]
        SETUP    F two[2]
        test_this.py::test_me[2] (fixtures used: two).
        TEARDOWN F two[2]

============================================================================= 2 passed in 0.01s ==============================================================================

Compare loaded plugins and used fixtures (python version doesn't matter)

@smarie
Copy link
Owner

smarie commented Jul 10, 2020

Indeed, thanks for spotting this ! I'll have a look.

@smarie smarie closed this as completed in 4334ae1 Jul 10, 2020
@smarie
Copy link
Owner

smarie commented Jul 10, 2020

fixed in 2.0.3, thanks a lot !

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

2 participants