Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValueError uses no argument in pytest, does order of decorators matter?

Tags:

python

pytest

I ran into a very cryptic error in pytest, after adding a '@pytest.mark.parametrize' decorator the test started throwing the following error:

ValueError: <function ... at ...> uses no argument 'parameters'

I found the source of the error here

Here's what the signature of my function looks like (simplified):

@patch('dog')
@pytest.mark.parametrize('foo,bar', test_data)
def test_update_activity_details_trainer_and_gear(self, foo, bar, dog):
like image 634
sshevlyagin Avatar asked Jul 01 '18 18:07

sshevlyagin


1 Answers

Turns out the order of decorators in pytest matters

@pytest.mark.parametrize('foo,bar', test_data)
@patch('dog')
def test_update_activity_details_trainer_and_gear(self, dog, foo, bar):

Changing the order removed the error

like image 112
sshevlyagin Avatar answered Sep 24 '22 19:09

sshevlyagin