Reputation: 1715
When I run flake8 I get the following error:
./test_sample.py:4:2: PT006 wrong name(s) type in @pytest.mark.parametrize, expected tuple
Here is my code
import pytest
@pytest.mark.parametrize('foo,bar', [(1, 1), (2, 2)])
def test_foo(foo, bar):
assert foo == bar
pip freeze | egrep flake8
:
flake8==3.8.4
flake8-plugin-utils==1.3.1
flake8-pytest-style==1.3.0
How do I fix the error?
Upvotes: 6
Views: 2952
Reputation: 1715
This error is generated by flake8-pytest-style
. See https://github.com/m-burst/flake8-pytest-style/blob/master/docs/rules/PT006.md
You have two options:
'foo,bar'
with ('foo', 'bar')
import pytest
@pytest.mark.parametrize(('foo', 'bar'), [(1, 1), (2, 2)])
def test_foo(foo, bar):
assert foo == bar
pytest-parametrize-names-type
configuration option by adding a file named .flake8
with the following contents to the root of your project:
[flake8]
pytest-parametrize-names-type = csv
Upvotes: 11