Fix: handle CollectReport in folded_skips function
This commit is contained in:
		
							parent
							
								
									9824499396
								
							
						
					
					
						commit
						03ce0adb79
					
				|  | @ -349,7 +349,8 @@ def folded_skips(skipped): | |||
|         # folding reports with global pytestmark variable | ||||
|         # this is workaround, because for now we cannot identify the scope of a skip marker | ||||
|         # TODO: revisit after marks scope would be fixed | ||||
|         if event.when == 'setup' and 'skip' in keywords and 'pytestmark' not in keywords: | ||||
|         when = getattr(event, 'when', None) | ||||
|         if when == 'setup' and 'skip' in keywords and 'pytestmark' not in keywords: | ||||
|             key = (key[0], None, key[2], ) | ||||
|         d.setdefault(key, []).append(event) | ||||
|     l = [] | ||||
|  |  | |||
|  | @ -663,7 +663,7 @@ def test_skipif_class(testdir): | |||
| 
 | ||||
| 
 | ||||
| def test_skip_reasons_folding(): | ||||
|     path = 'xyz' | ||||
|     path = "xyz" | ||||
|     lineno = 3 | ||||
|     message = "justso" | ||||
|     longrepr = (path, lineno, message) | ||||
|  | @ -680,10 +680,15 @@ def test_skip_reasons_folding(): | |||
|     ev2.longrepr = longrepr | ||||
|     ev2.skipped = True | ||||
| 
 | ||||
|     l = folded_skips([ev1, ev2]) | ||||
|     # ev3 might be a collection report | ||||
|     ev3 = X() | ||||
|     ev3.longrepr = longrepr | ||||
|     ev3.skipped = True | ||||
| 
 | ||||
|     l = folded_skips([ev1, ev2, ev3]) | ||||
|     assert len(l) == 1 | ||||
|     num, fspath, lineno, reason = l[0] | ||||
|     assert num == 2 | ||||
|     assert num == 3 | ||||
|     assert fspath == path | ||||
|     assert lineno == lineno | ||||
|     assert reason == message | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue