added test to verify injection.

This commit is contained in:
aselus-hub 2015-12-10 14:45:36 -08:00
parent ec02f694ef
commit dfaeefd692
1 changed files with 16 additions and 0 deletions

View File

@ -1076,3 +1076,19 @@ def test_dont_collect_non_function_callable(testdir):
'WC2 *',
'*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()