Skip to content

Commit

Permalink
Fixed errors thrown when using pytest Tavern
Browse files Browse the repository at this point in the history
  • Loading branch information
virdok committed Jun 10, 2024
1 parent 922edfa commit be082f8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pytest_reportportal/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,18 @@ def _get_code_ref(self, item):
# same path on different systems and do not affect Test Case ID on
# different systems
path = os.path.relpath(str(item.fspath), ROOT_DIR).replace('\\', '/')
method_name = item.originalname if item.originalname is not None \
method_name = item.originalname if hasattr(item, 'originalname') \
and item.originalname is not None \
else item.name
parent = item.parent
classes = [method_name]
while not isinstance(parent, Module):
if not isinstance(parent, Instance):
if not isinstance(parent, Instance) and hasattr(parent, 'name'):
classes.append(parent.name)
parent = parent.parent
if hasattr(parent, 'parent'):
parent = parent.parent
else:
break
classes.reverse()
class_path = '.'.join(classes)
return '{0}:{1}'.format(path, class_path)
Expand Down

0 comments on commit be082f8

Please sign in to comment.