fix issue106: allow parametrize to be applied per-class/per-module

This commit is contained in:
holger krekel
2011-12-28 15:47:19 +00:00
parent ccc1b21ebd
commit f2c8a837af
5 changed files with 44 additions and 28 deletions

View File

@@ -1048,6 +1048,23 @@ class TestMetafunc:
assert metafunc._calls[1].funcargs == dict(x=3, y=4)
assert metafunc._calls[1].id == "3-4"
def test_parametrize_multiple_times(self, testdir):
testdir.makepyfile("""
import pytest
pytestmark = pytest.mark.parametrize("x", [1,2])
def test_func(x):
assert 0, x
class TestClass:
pytestmark = pytest.mark.parametrize("y", [3,4])
def test_meth(self, x, y):
assert 0, x
""")
result = testdir.runpytest()
assert result.ret == 1
result.stdout.fnmatch_lines([
"*6 fail*",
])
class TestMetafuncFunctional:
def test_attributes(self, testdir):
p = testdir.makepyfile("""