@@ -32,7 +32,7 @@ def __init__(self, py_test_service,
3232 :param endpoint: Report Portal API endpoint
3333 """
3434 # Test Item result
35- self .PyTestService = py_test_service
35+ self .py_test_service = py_test_service
3636 self .result = None
3737 self .issue = {}
3838 self ._log_level = log_level
@@ -52,7 +52,7 @@ def pytest_runtest_protocol(self, item):
5252 :return: generator object
5353 """
5454 self ._add_issue_id_marks (item )
55- item_id = self .PyTestService .start_pytest_item (item )
55+ item_id = self .py_test_service .start_pytest_item (item )
5656 if PYTEST_HAS_LOGGING_PLUGIN :
5757 # This check can go away once we support pytest >= 3.3
5858 with patching_logger_class ():
@@ -62,7 +62,7 @@ def pytest_runtest_protocol(self, item):
6262 else :
6363 yield
6464 # Finishing item in RP
65- self .PyTestService .finish_pytest_item (
65+ self .py_test_service .finish_pytest_item (
6666 item , item_id , self .result or 'SKIPPED' , self .issue or None )
6767
6868 @pytest .hookimpl (hookwrapper = True )
@@ -76,10 +76,9 @@ def pytest_runtest_makereport(self, item):
7676 report = (yield ).get_result ()
7777
7878 if report .longrepr :
79- self .PyTestService .post_log (
79+ self .py_test_service .post_log (
8080 escape (report .longreprtext , False ),
81- loglevel = 'ERROR' ,
82- )
81+ loglevel = 'ERROR' )
8382
8483 # Defining test result
8584 if report .when == 'setup' :
@@ -88,17 +87,18 @@ def pytest_runtest_makereport(self, item):
8887
8988 if report .failed :
9089 self .result = 'FAILED'
90+ self ._add_issue_info (item , report )
9191 elif report .skipped :
9292 if self .result in (None , 'PASSED' ):
9393 self .result = 'SKIPPED'
94+ if self .py_test_service .rp .is_skipped_an_issue :
95+ self ._add_issue_info (item , report )
9496 else :
9597 if self .result is None :
9698 self .result = 'PASSED'
9799
98- # Adding test comment and issue type
99- self ._add_issue_info (item , report )
100-
101- def _add_issue_id_marks (self , item ):
100+ @staticmethod
101+ def _add_issue_id_marks (item ):
102102 """Add marks with issue id.
103103
104104 :param item: pytest test item
@@ -124,6 +124,7 @@ def _add_issue_id_marks(self, item):
124124 def _add_issue_info (self , item , report ):
125125 """Add issues description and issue_type to the test item.
126126
127+ ToDo: THIS NEEDS TO BE REWRITTEN. LOOKS UGLY.
127128 :param item: pytest test item
128129 :param report: pytest report instance
129130 """
@@ -166,12 +167,12 @@ def _add_issue_info(self, item, report):
166167 # default value
167168 issue_type = "TI" if issue_type is None else issue_type
168169
169- if issue_type and \
170- ( issue_type in getattr ( self .PyTestService , 'issue_types' , () )):
170+ if issue_type and issue_type in getattr (
171+ self .py_test_service , 'issue_types' , ()):
171172 if comment :
172173 self .issue ['comment' ] = comment
173174 self .issue ['issueType' ] = \
174- self .PyTestService .issue_types [issue_type ]
175+ self .py_test_service .issue_types [issue_type ]
175176 # self.issue['ignoreAnalyzer'] = True ???
176177 elif (report .when == 'setup' ) and report .skipped :
177178 self .issue ['issueType' ] = 'NOT_ISSUE'
0 commit comments