Skip to content

Commit 467533f

Browse files
authored
Merge pull request #345 from reportportal/develop
Release
2 parents f8d62fa + a10282e commit 467533f

File tree

7 files changed

+32
-23
lines changed

7 files changed

+32
-23
lines changed

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+
### Fixed
5+
- Log line reference for Python 3.11, by @HardNorth
6+
### Changed
7+
- Client version updated on [5.4.0](https://github.com/reportportal/client-Python/releases/tag/5.4.0), by @HardNorth
8+
9+
## [5.2.0]
410
### Added
511
- `rp_launch_uuid_print` and `rp_launch_uuid_print_output` configuration parameters, by @HardNorth
612
### Removed

pytest_reportportal/plugin.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ def pytest_sessionstart(session):
104104

105105
if is_control(config) and not config._reporter_config.rp_launch_id:
106106
config.py_test_service.start_launch()
107-
if config._reporter_config.rp_launch_uuid_print:
108-
launch_id = config.py_test_service.rp.launch_id
109-
print(f'Report Portal Launch UUID: {launch_id}', file=config._reporter_config.rp_launch_uuid_print_output)
110107
if config.pluginmanager.hasplugin('xdist') \
111108
or config.pluginmanager.hasplugin('pytest-parallel'):
112109
if not wait_launch(session.config.py_test_service.rp):

pytest_reportportal/rp_logging.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""RPLogger class for low-level logging in tests."""
22

3+
import sys
34
import logging
45
import threading
56
from contextlib import contextmanager
@@ -108,7 +109,17 @@ def _log(self, *args, **kwargs):
108109
if attachment is not None:
109110
kwargs.setdefault('extra', {}).update(
110111
{'attachment': attachment})
111-
return original_func(self, *args, **kwargs)
112+
# Python 3.11 start catches stack frames in wrappers,
113+
# so add additional stack level skip to not show it
114+
if sys.version_info >= (3, 11):
115+
my_kwargs = kwargs.copy()
116+
if 'stacklevel' in kwargs:
117+
my_kwargs['stacklevel'] = my_kwargs['stacklevel'] + 1
118+
else:
119+
my_kwargs['stacklevel'] = 2
120+
return original_func(self, *args, **my_kwargs)
121+
else:
122+
return original_func(self, *args, **kwargs)
112123

113124
return _log
114125

pytest_reportportal/service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,9 @@ def start(self) -> None:
890890
retries=self._config.rp_api_retries,
891891
verify_ssl=self._config.rp_verify_ssl,
892892
launch_id=launch_id,
893-
log_batch_payload_size=self._config.rp_log_batch_payload_size
893+
log_batch_payload_size=self._config.rp_log_batch_payload_size,
894+
launch_uuid_print=self._config.rp_launch_uuid_print,
895+
print_output=self._config.rp_launch_uuid_print_output
894896
)
895897
if hasattr(self.rp, "get_project_settings"):
896898
self.project_settings = self.rp.get_project_settings()

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dill>=0.3.6
22
pytest>=3.8.0
3-
reportportal-client==5.3.5
3+
reportportal-client==5.4.0
44
aenum>=3.1.0
55
requests>=2.27.1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from setuptools import setup
66

77

8-
__version__ = '5.2.0'
8+
__version__ = '5.2.1'
99

1010

1111
def read_file(fname):

tests/integration/test_config_handling.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,7 @@ def test_rp_log_format(mock_client_init):
131131
expect(mock_client.log.call_count == 1)
132132
message = mock_client.log.call_args_list[0][0][1]
133133
expect(len(message) > 0)
134-
if sys.version_info < (3, 11):
135-
expect(message == '(examples.test_rp_logging) ' + LOG_MESSAGE +
136-
' (test_rp_logging.py:24)')
137-
else:
138-
# FIXME: implement stacktrace preserve solution for Python 3.11
139-
warnings.warn('FIXME: implement stacktrace preserve solution for Python 3.11', RuntimeWarning)
140-
expect(message == '(examples.test_rp_logging) ' + LOG_MESSAGE +
141-
' (rp_logging.py:111)')
134+
expect(message == f'(examples.test_rp_logging) {LOG_MESSAGE} (test_rp_logging.py:24)')
142135
assert_expectations()
143136

144137

@@ -304,8 +297,8 @@ def test_launch_uuid_print(mock_client_init):
304297

305298
assert int(result) == 0, 'Exit code should be 0 (no errors)'
306299
expect(mock_client_init.call_count == 1)
307-
308-
expect('Report Portal Launch UUID:' in str_io.getvalue())
300+
expect(mock_client_init.call_args_list[0][1]['launch_uuid_print'] == print_uuid)
301+
expect(mock_client_init.call_args_list[0][1]['print_output'] is str_io)
309302
assert_expectations()
310303

311304

@@ -326,8 +319,8 @@ def test_launch_uuid_print_stderr(mock_client_init):
326319

327320
assert int(result) == 0, 'Exit code should be 0 (no errors)'
328321
expect(mock_client_init.call_count == 1)
329-
330-
expect('Report Portal Launch UUID:' in str_io.getvalue())
322+
expect(mock_client_init.call_args_list[0][1]['launch_uuid_print'] == print_uuid)
323+
expect(mock_client_init.call_args_list[0][1]['print_output'] is str_io)
331324
assert_expectations()
332325

333326

@@ -348,8 +341,8 @@ def test_launch_uuid_print_invalid_output(mock_client_init):
348341

349342
assert int(result) == 0, 'Exit code should be 0 (no errors)'
350343
expect(mock_client_init.call_count == 1)
351-
352-
expect('Report Portal Launch UUID:' in str_io.getvalue())
344+
expect(mock_client_init.call_args_list[0][1]['launch_uuid_print'] == print_uuid)
345+
expect(mock_client_init.call_args_list[0][1]['print_output'] is str_io)
353346
assert_expectations()
354347

355348

@@ -368,6 +361,6 @@ def test_no_launch_uuid_print(mock_client_init):
368361

369362
assert int(result) == 0, 'Exit code should be 0 (no errors)'
370363
expect(mock_client_init.call_count == 1)
371-
372-
expect('Report Portal Launch UUID:' not in str_io.getvalue())
364+
expect(mock_client_init.call_args_list[0][1]['launch_uuid_print'] is False)
365+
expect(mock_client_init.call_args_list[0][1]['print_output'] is str_io)
373366
assert_expectations()

0 commit comments

Comments
 (0)