Test file run twice fails if it contains marked class #683
This commit is contained in:
committed by
Floris Bruynooghe
parent
985fd0cc2b
commit
e8f4819876
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
import py, pytest
|
||||
from _pytest.mark import MarkGenerator as Mark
|
||||
|
||||
@@ -84,6 +86,22 @@ class TestMark:
|
||||
assert g.some.kwargs['reason2'] == "456"
|
||||
|
||||
|
||||
def test_marked_class_run_twice(testdir, request):
|
||||
"""Test fails file is run twice that contains marked class.
|
||||
See issue#683.
|
||||
"""
|
||||
py_file = testdir.makepyfile("""
|
||||
import pytest
|
||||
@pytest.mark.parametrize('abc', [1, 2, 3])
|
||||
class Test1(object):
|
||||
def test_1(self, abc):
|
||||
assert abc in [1, 2, 3]
|
||||
""")
|
||||
file_name = os.path.basename(py_file.strpath)
|
||||
rec = testdir.inline_run(file_name, file_name)
|
||||
rec.assertoutcome(passed=6)
|
||||
|
||||
|
||||
def test_ini_markers(testdir):
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
|
||||
Reference in New Issue
Block a user