Revert "[parametrize] enforce explicit argnames declaration (#6330)"
This reverts commit 9e262038c8.
Fix #6909
This commit is contained in:
@@ -463,7 +463,7 @@ class TestFunction:
|
||||
return '3'
|
||||
|
||||
@pytest.mark.parametrize('fix2', ['2'])
|
||||
def test_it(fix1, fix2):
|
||||
def test_it(fix1):
|
||||
assert fix1 == '21'
|
||||
assert not fix3_instantiated
|
||||
"""
|
||||
|
||||
@@ -36,9 +36,6 @@ class TestMetafunc:
|
||||
class DefinitionMock(python.FunctionDefinition):
|
||||
obj = attr.ib()
|
||||
|
||||
def listchain(self):
|
||||
return []
|
||||
|
||||
names = fixtures.getfuncargnames(func)
|
||||
fixtureinfo = FuncFixtureInfoMock(names) # type: Any
|
||||
definition = DefinitionMock._create(func) # type: Any
|
||||
@@ -1902,51 +1899,3 @@ class TestMarkersWithParametrization:
|
||||
"*= 6 passed in *",
|
||||
]
|
||||
)
|
||||
|
||||
def test_parametrize_explicit_parameters_func(self, testdir: Testdir) -> None:
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fixture(arg):
|
||||
return arg
|
||||
|
||||
@pytest.mark.parametrize("arg", ["baz"])
|
||||
def test_without_arg(fixture):
|
||||
assert "baz" == fixture
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest()
|
||||
result.assert_outcomes(error=1)
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
'*In function "test_without_arg"*',
|
||||
'*Parameter "arg" should be declared explicitly via indirect or in function itself*',
|
||||
]
|
||||
)
|
||||
|
||||
def test_parametrize_explicit_parameters_method(self, testdir: Testdir) -> None:
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
|
||||
class Test:
|
||||
@pytest.fixture
|
||||
def test_fixture(self, argument):
|
||||
return argument
|
||||
|
||||
@pytest.mark.parametrize("argument", ["foobar"])
|
||||
def test_without_argument(self, test_fixture):
|
||||
assert "foobar" == test_fixture
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest()
|
||||
result.assert_outcomes(error=1)
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
'*In function "test_without_argument"*',
|
||||
'*Parameter "argument" should be declared explicitly via indirect or in function itself*',
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user