Alert user about other parametrize spellings.

This commit is contained in:
Florian Bruhin
2015-08-07 07:51:59 +02:00
parent 4f83586f55
commit b59376bea4
2 changed files with 13 additions and 8 deletions

View File

@@ -683,18 +683,20 @@ class TestMetafuncFunctional:
reprec.assert_outcomes(passed=4)
@pytest.mark.issue463
def test_parameterize_misspelling(self, testdir):
@pytest.mark.parametrize('attr', ['parametrise', 'parameterize',
'parameterise'])
def test_parametrize_misspelling(self, testdir, attr):
testdir.makepyfile("""
import pytest
@pytest.mark.parameterize("x", range(2))
@pytest.mark.{0}("x", range(2))
def test_foo(x):
pass
""")
""".format(attr))
reprec = testdir.inline_run('--collectonly')
failures = reprec.getfailures()
assert len(failures) == 1
expectederror = "MarkerError: test_foo has 'parameterize', spelling should be 'parametrize'"
expectederror = "MarkerError: test_foo has '{0}', spelling should be 'parametrize'".format(attr)
assert expectederror in failures[0].longrepr.reprcrash.message