File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change 66
77class RPReportListener (object ):
88 def __init__ (self ):
9- # Identifier if TestItem is called:
10- # if setup is failed, pytest will NOT call
11- # TestItem and Result will not reported!
12- self .called = False
13-
149 # Test Item result
1510 self .result = None
1611
1712 @pytest .hookimpl (hookwrapper = True )
1813 def pytest_runtest_protocol (self , item ):
1914 PyTestService .start_pytest_item (item )
2015 yield
21- item_result = self .result if self .called else 'SKIPPED'
22- PyTestService .finish_pytest_item (item_result )
23- self .called = False
16+ PyTestService .finish_pytest_item (self .result or 'SKIPPED' )
2417
2518 @pytest .hookimpl (hookwrapper = True )
2619 def pytest_runtest_makereport (self ):
@@ -33,14 +26,17 @@ def pytest_runtest_makereport(self):
3326 loglevel = 'ERROR' ,
3427 )
3528
36- if report .when == 'call' :
37- self .called = True
29+ if report .when == 'setup' :
30+ if report .failed :
31+ # This happens for example when a fixture fails to run
32+ # causing the test to error
33+ self .result = 'FAILED'
3834
35+ if report .when == 'call' :
3936 if report .passed :
4037 item_result = 'PASSED'
41- elif report .failed :
42- item_result = 'FAILED'
43- else :
38+ elif report .skipped :
4439 item_result = 'SKIPPED'
45-
40+ else :
41+ item_result = 'FAILED'
4642 self .result = item_result
You can’t perform that action at this time.
0 commit comments