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

Decorator order matters if using nice_parametrize #119

Open
AlbertoRFer opened this issue Apr 29, 2024 · 0 comments
Open

Decorator order matters if using nice_parametrize #119

AlbertoRFer opened this issue Apr 29, 2024 · 0 comments

Comments

@AlbertoRFer
Copy link

I am using nice_parametrize to keep my parameters together with their ids.
If I use

@parametrize("my_fixture", {"My case": ["test"]}, indirect=True)
@pytest.mark.it("My test")
def test(my_fixture):
  assert True

I find that my parameters are not being passed correctly. Specifically, while having a fixture with indirect=True no params are being passed to the fixture and I get :

params = request.param
E  AttributeError: 'SubRequest' object has no attribute 'param'

On the other hand if I invert the decorators order:

@pytest.mark.it("My test")
@parametrize("my_fixture", {"My case": ["test"]}, indirect=True)
def test(my_fixture):
  assert True

Then everything works as expected

I would still like to use @pytest.mark.it closer to the function header for readability purposes so I am wondering if there is something I can do.

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