commit
						85d1f0404a
					
				
							
								
								
									
										1
									
								
								AUTHORS
								
								
								
								
							
							
						
						
									
										1
									
								
								AUTHORS
								
								
								
								
							|  | @ -71,3 +71,4 @@ Eric Hunsberger | ||||||
| Simon Gomizelj | Simon Gomizelj | ||||||
| Russel Winder | Russel Winder | ||||||
| Ben Webb | Ben Webb | ||||||
|  | Alexei Kozlenok | ||||||
|  |  | ||||||
|  | @ -1,6 +1,10 @@ | ||||||
| 2.8.5.dev0 | 2.8.5.dev0 | ||||||
| ---------- | ---------- | ||||||
| 
 | 
 | ||||||
|  | - fix #1243: fixed injection to class breaking collection step, by replacing | ||||||
|  |   generated interation with list traversal, added test to verify in python/collect.py | ||||||
|  |   PR by Alexei Kozlenok, Thanks Ronny Pfannschmidt and Nicoddemus for the review and help. | ||||||
|  | 
 | ||||||
| - fix #1074: precompute junitxml chunks instead of storing the whole tree in objects | - fix #1074: precompute junitxml chunks instead of storing the whole tree in objects | ||||||
|   Thanks Bruno Oliveira for the report and Ronny Pfannschmidt for the PR |   Thanks Bruno Oliveira for the report and Ronny Pfannschmidt for the PR | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -451,7 +451,7 @@ class PyCollector(PyobjMixin, pytest.Collector): | ||||||
|         seen = {} |         seen = {} | ||||||
|         l = [] |         l = [] | ||||||
|         for dic in dicts: |         for dic in dicts: | ||||||
|             for name, obj in dic.items(): |             for name, obj in list(dic.items()): | ||||||
|                 if name in seen: |                 if name in seen: | ||||||
|                     continue |                     continue | ||||||
|                 seen[name] = True |                 seen[name] = True | ||||||
|  |  | ||||||
|  | @ -1076,3 +1076,26 @@ 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): | ||||||
|  |     """Tests whether injection during collection time will terminate testing. | ||||||
|  | 
 | ||||||
|  |     In this case the error should not occur if the TestClass itself | ||||||
|  |     is modified during collection time, and the original method list | ||||||
|  |     is still used for collection. | ||||||
|  |     """ | ||||||
|  |     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() | ||||||
|  |     result.stdout.fnmatch_lines(['*1 passed*']) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue