Bug report
What's wrong
$ flake8 --pytest-parametrize-names-type tuple simple_test.py
simple_test.py:21:2: PT006 wrong name(s) type in @pytest.mark.parametrize, expected string
If I asked for tuples, why am I bothered with strings ?
How it should work
If I ask for tuples as parameter names, there should not be any interpretation on the flake8-pytest-style side, it should only check that what I asked for is what it finds in the code:
# Assume this file is named simple_test.py
import pytest
# A string
@pytest.mark.parametrize('single_param', (
pytest.param('hello'),
))
def test1(single_param):
pass
# ``('single_param')`` is not a tuple, it is a parenthesized str, hence a str.
@pytest.mark.parametrize(('single_param'), (
pytest.param('hello'),
))
def test2(single_param):
pass
# A 1 str tuple
@pytest.mark.parametrize(('single_param', ), (
pytest.param('hello'),
))
def test3(single_param):
pass
# A 2 str tuple (to show that tuple length seem to be the matter)
@pytest.mark.parametrize(('single_param', 'two value'), (
pytest.param('hello'),
))
def test4(single_param):
pass
Then run:
$ flake8 --pytest-parametrize-names-type tuple simple_test.py
simple_test.py:21:2: PT006 wrong name(s) type in @pytest.mark.parametrize, expected string
An issue is reported only for the one valid syntax. More over the error is confusing: I ask for tuples, I am told I should have strings.
System information
- Operating system:
- Python version:
- flake8 version:
- flake8-pytest-style version:
Bug report
What's wrong
If I asked for tuples, why am I bothered with strings ?
How it should work
If I ask for tuples as parameter names, there should not be any interpretation on the flake8-pytest-style side, it should only check that what I asked for is what it finds in the code:
Then run:
An issue is reported only for the one valid syntax. More over the error is confusing: I ask for tuples, I am told I should have strings.
System information