added test to verify injection.
This commit is contained in:
parent
ec02f694ef
commit
dfaeefd692
|
@ -1076,3 +1076,19 @@ def test_dont_collect_non_function_callable(testdir):
|
||||||
'WC2 *',
|
'WC2 *',
|
||||||
'*1 passed, 1 pytest-warnings in *',
|
'*1 passed, 1 pytest-warnings in *',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_class_injection_does_not_break_collection(testdir):
|
||||||
|
testdir.makeconftest("""
|
||||||
|
from test_inject import TestClass
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
TestClass.changed_var = {}
|
||||||
|
""")
|
||||||
|
testdir.makepyfile(test_inject='''
|
||||||
|
class TestClass(object):
|
||||||
|
def test_injection(self):
|
||||||
|
"""Test being parametrized."""
|
||||||
|
pass
|
||||||
|
''')
|
||||||
|
result = testdir.runpytest()
|
||||||
|
assert "RuntimeError: dictionary changed size during iteration" not in result.stdout.str()
|
Loading…
Reference in New Issue