2424
2525from _pytest .doctest import DoctestItem
2626from aenum import auto , Enum , unique
27+ from py .path import local
2728from pytest import Class , Function , Module , Package , Item , Session , PytestWarning
2829from reportportal_client .aio import Task
2930from reportportal_client .core .rp_issues import Issue , ExternalIssue
@@ -167,6 +168,8 @@ def issue_types(self) -> Dict[str, str]:
167168 project_settings = self .project_settings
168169 if not isinstance (self .project_settings , dict ):
169170 project_settings = project_settings .blocking_result ()
171+ if not project_settings :
172+ return self ._issue_types
170173 for values in project_settings ["subTypes" ].values ():
171174 for item in values :
172175 self ._issue_types [item ["shortName" ]] = item ["locator" ]
@@ -210,7 +213,7 @@ def start_launch(self) -> Optional[str]:
210213 LOGGER .debug ('ReportPortal - Launch started: id=%s' , self ._launch_id )
211214 return self ._launch_id
212215
213- def _get_item_dirs (self , item : Item ) -> List [str ]:
216+ def _get_item_dirs (self , item : Item ) -> List [local ]:
214217 """
215218 Get directory of item.
216219
@@ -219,8 +222,7 @@ def _get_item_dirs(self, item: Item) -> List[str]:
219222 """
220223 root_path = item .session .config .rootdir .strpath
221224 dir_path = item .fspath .new (basename = "" )
222- rel_dir = dir_path .new (dirname = dir_path .relto (root_path ), basename = "" ,
223- drive = "" )
225+ rel_dir = dir_path .new (dirname = dir_path .relto (root_path ), basename = "" , drive = "" )
224226 return [d for d in rel_dir .parts (reverse = False ) if d .basename ]
225227
226228 def _get_tree_path (self , item : Item ) -> List [Item ]:
@@ -874,6 +876,10 @@ def report_fixture(self, name: str, error_msg: str) -> None:
874876 :param name: Name of the fixture
875877 :param error_msg: Error message
876878 """
879+ if not self .rp :
880+ yield
881+ return
882+
877883 reporter = self .rp .step_reporter
878884 item_id = reporter .start_nested_step (name , timestamp ())
879885
@@ -884,6 +890,7 @@ def report_fixture(self, name: str, error_msg: str) -> None:
884890 if exception :
885891 if type (exception ).__name__ != 'Skipped' :
886892 status = 'FAILED'
893+ self .post_log (name , error_msg , log_level = 'ERROR' )
887894 reporter .finish_nested_step (item_id , timestamp (), status )
888895 except Exception as e :
889896 LOGGER .error ('Failed to report fixture: %s' , name )
0 commit comments