Skip to content

Commit 2a5d463

Browse files
authored
Merge branch 'reportportal:develop' into restore_rp_display_suite_test_file
2 parents e9b3bea + bed0455 commit 2a5d463

File tree

7 files changed

+33
-17
lines changed

7 files changed

+33
-17
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ]
23+
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
2424
steps:
2525
- name: Checkout repository
2626
uses: actions/checkout@v4
@@ -39,7 +39,7 @@ jobs:
3939
run: tox
4040

4141
- name: Upload coverage to Codecov
42-
if: matrix.python-version == 3.8 && success()
42+
if: matrix.python-version == 3.10 && success()
4343
uses: codecov/codecov-action@v4
4444
with:
4545
token: ${{ secrets.CODECOV_TOKEN }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Added
5+
- Support for `Python 3.13`, by @HardNorth
6+
### Fixed
7+
- Agent crash if Client could not be initialized, by @HardNorth
8+
### Changed
9+
- Client version updated on [5.5.10](https://github.com/reportportal/client-Python/releases/tag/5.5.10), by @HardNorth
410

511
## [5.4.5]
612
### Fixed

pytest_reportportal/rp_logging.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import threading
1919
from contextlib import contextmanager
2020
from functools import wraps
21+
from typing import Any
2122

2223
from reportportal_client import current, set_current
2324
from reportportal_client import RPLogger
@@ -116,23 +117,22 @@ def patching_logger_class():
116117
try:
117118
def wrap_log(original_func):
118119
@wraps(original_func)
119-
def _log(self, *args, **kwargs):
120-
attachment = kwargs.pop('attachment', None)
120+
def _log(self, *args: list[Any], **kwargs: dict[str, Any]):
121+
my_kwargs = kwargs.copy()
122+
attachment = my_kwargs.pop('attachment', None)
121123
if attachment is not None:
122-
kwargs.setdefault('extra', {}).update(
123-
{'attachment': attachment})
124+
my_kwargs.setdefault('extra', {}).update({'attachment': attachment})
125+
124126
# Python 3.11 start catches stack frames in wrappers,
125127
# so add additional stack level skip to not show it
126128
if sys.version_info >= (3, 11):
127-
my_kwargs = kwargs.copy()
128-
if 'stacklevel' in kwargs:
129+
if 'stacklevel' in my_kwargs:
129130
my_kwargs['stacklevel'] = my_kwargs['stacklevel'] + 1
130131
else:
131132
my_kwargs['stacklevel'] = 2
132133
return original_func(self, *args, **my_kwargs)
133134
else:
134-
return original_func(self, *args, **kwargs)
135-
135+
return original_func(self, *args, **my_kwargs)
136136
return _log
137137

138138
def wrap_makeRecord(original_func):

pytest_reportportal/service.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
from _pytest.doctest import DoctestItem
2626
from aenum import auto, Enum, unique
27+
from py.path import local
2728
from pytest import Class, Function, Module, Package, Item, Session, PytestWarning
2829
from reportportal_client.aio import Task
2930
from 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)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dill>=0.3.6
22
pytest>=3.8.0
3-
reportportal-client~=5.5.9
3+
reportportal-client~=5.5.10
44
aenum>=3.1.0

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def read_file(fname):
5252
'Programming Language :: Python :: 3.9',
5353
'Programming Language :: Python :: 3.10',
5454
'Programming Language :: Python :: 3.11',
55-
'Programming Language :: Python :: 3.12'
55+
'Programming Language :: Python :: 3.12',
56+
'Programming Language :: Python :: 3.13'
5657
],
5758
entry_points={
5859
'pytest11': [

tox.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ envlist =
88
py310
99
py311
1010
py312
11+
py313
1112

1213
[testenv]
1314
deps =
@@ -27,8 +28,9 @@ commands = pre-commit run --all-files --show-diff-on-failure
2728
[gh-actions]
2829
python =
2930
3.7: py37
30-
3.8: pep, py38
31+
3.8: py38
3132
3.9: py39
32-
3.10: py310
33+
3.10: pep, py310
3334
3.11: py311
3435
3.12: py312
36+
3.13: py313

0 commit comments

Comments
 (0)