Skip to content

Commit 763cd07

Browse files
authored
Merge pull request #416 from reportportal/develop
Release
2 parents 3dc6dec + 62e4d0d commit 763cd07

File tree

8 files changed

+40
-35
lines changed

8 files changed

+40
-35
lines changed

CHANGELOG.md

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

33
## [Unreleased]
4+
### Changed
5+
- Client version updated to [5.7.2](https://github.com/reportportal/client-Python/releases/tag/5.7.2), by @HardNorth
6+
### Removed
7+
- `aenum` dependency, by @HardNorth
8+
- `dill` dependency, by @HardNorth
9+
10+
## [5.6.2]
411
### Added
512
- `rp_launch_uuid` configuration parameter, by @HardNorth
613
- `rp_launch_attributes` cmd argument, by @fahadnaeemkhan

pytest_reportportal/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AgentConfig:
2828
"""Storage for the RP agent initialization attributes."""
2929

3030
rp_enabled: bool
31-
rp_client_type: Optional[ClientType]
31+
rp_client_type: ClientType
3232
rp_rerun: Optional[bool]
3333
pconfig: Config
3434
rp_endpoint: str
@@ -72,7 +72,7 @@ class AgentConfig:
7272
rp_verify_ssl: Union[bool, str]
7373
rp_launch_timeout: int
7474
rp_launch_uuid_print: bool
75-
rp_launch_uuid_print_output: Optional[OutputType]
75+
rp_launch_uuid_print_output: OutputType
7676
rp_http_timeout: Optional[Union[tuple[float, float], float]]
7777
rp_report_fixtures: bool
7878

@@ -174,7 +174,7 @@ def __init__(self, pytest_config: Config) -> None:
174174

175175
self.rp_launch_uuid_print = to_bool(self.find_option(pytest_config, "rp_launch_uuid_print") or "False")
176176
print_output = self.find_option(pytest_config, "rp_launch_uuid_print_output")
177-
self.rp_launch_uuid_print_output = OutputType[print_output.upper()] if print_output else None
177+
self.rp_launch_uuid_print_output = OutputType[print_output.upper()] if print_output else OutputType.STDOUT
178178
client_type = self.find_option(pytest_config, "rp_client_type")
179179
self.rp_client_type = ClientType[client_type.upper()] if client_type else ClientType.SYNC
180180

pytest_reportportal/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
import logging
1717
import os.path
18+
import pickle
1819
import time
1920
from logging import Logger
2021
from typing import Any, Callable, Generator
2122

2223
import _pytest.logging
23-
import dill as pickle
2424
import pytest
2525

2626
# noinspection PyPackageRequirements

pytest_reportportal/service.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
import threading
2121
import traceback
2222
from collections import OrderedDict
23+
from enum import Enum
2324
from functools import wraps
2425
from os import curdir
2526
from time import sleep, time
2627
from typing import Any, Callable, Generator, Optional, Union
2728

2829
from _pytest.doctest import DoctestItem
29-
from aenum import Enum, auto, unique
3030
from py.path import local
3131
from pytest import Class, Function, Item, Module, Package, PytestWarning, Session
3232
from reportportal_client.aio import Task
@@ -74,7 +74,7 @@
7474
except ImportError:
7575
Rule = type("dummy", (), {}) # Old pytest-bdd versions do not have Rule
7676

77-
from reportportal_client import RP, ClientType, create_client
77+
from reportportal_client import RP, OutputType, create_client
7878
from reportportal_client.helpers import dict_to_payload, gen_attributes, get_launch_sys_attrs, get_package_version
7979

8080
LOGGER = logging.getLogger(__name__)
@@ -125,25 +125,23 @@ def trim_docstring(docstring: str) -> str:
125125
return "\n".join(trimmed)
126126

127127

128-
@unique
129128
class LeafType(Enum):
130129
"""This class stores test item path types."""
131130

132-
DIR = auto()
133-
FILE = auto()
134-
CODE = auto()
135-
ROOT = auto()
136-
SUITE = auto()
137-
NESTED = auto()
131+
DIR = 1
132+
FILE = 2
133+
CODE = 3
134+
ROOT = 4
135+
SUITE = 5
136+
NESTED = 6
138137

139138

140-
@unique
141139
class ExecStatus(Enum):
142140
"""This class stores test item path types."""
143141

144-
CREATED = auto()
145-
IN_PROGRESS = auto()
146-
FINISHED = auto()
142+
CREATED = 1
143+
IN_PROGRESS = 2
144+
FINISHED = 3
147145

148146

149147
def check_rp_enabled(func):
@@ -190,7 +188,7 @@ def __init__(self, agent_config: AgentConfig) -> None:
190188
self._start_tracker = set()
191189
self._launch_id = None
192190
self.agent_name = "pytest-reportportal"
193-
self.agent_version = get_package_version(self.agent_name)
191+
self.agent_version = get_package_version(self.agent_name) or "None"
194192
self.ignored_attributes = []
195193
self.parent_item_id = None
196194
self.rp = None
@@ -221,7 +219,7 @@ def _get_launch_attributes(self, ini_attrs: Optional[list[dict[str, str]]]) -> l
221219
attributes = ini_attrs or []
222220
system_attributes = get_launch_sys_attrs()
223221
system_attributes["agent"] = "{}|{}".format(self.agent_name, self.agent_version)
224-
return attributes + dict_to_payload(system_attributes)
222+
return attributes + (dict_to_payload(system_attributes) or [])
225223

226224
def _build_start_launch_rq(self) -> dict[str, Any]:
227225
rp_launch_attributes = self._config.rp_launch_attributes
@@ -366,6 +364,7 @@ def _get_scenario_template(self, scenario: Scenario) -> Optional[ScenarioTemplat
366364
break
367365
if scenario_template and isinstance(scenario_template, ScenarioTemplate):
368366
return scenario_template
367+
return None
369368

370369
def _get_method_name(self, item: Item) -> str:
371370
"""Get the original test method name.
@@ -650,20 +649,20 @@ def _get_test_case_id(
650649
else:
651650
return base_name + param_str
652651

653-
def _get_issue_ids(self, mark):
654-
issue_ids = mark.kwargs.get("issue_id", [])
652+
def _get_issue_ids(self, mark) -> list[Any]:
653+
issue_ids = mark.kwargs.get("issue_id", []) or []
655654
if not isinstance(issue_ids, list):
656655
issue_ids = [issue_ids]
657656
return issue_ids
658657

659-
def _get_issue_urls(self, mark, default_url):
658+
def _get_issue_urls(self, mark, default_url: str) -> list[Optional[str]]:
660659
issue_ids = self._get_issue_ids(mark)
661660
if not issue_ids:
662-
return None
661+
return []
663662
mark_url = mark.kwargs.get("url", None) or default_url
664-
return [mark_url.format(issue_id=issue_id) if mark_url else None for issue_id in issue_ids]
663+
return [str(mark_url).format(issue_id=str(issue_id)) if mark_url else None for issue_id in issue_ids]
665664

666-
def _get_issue_description_line(self, mark, default_url):
665+
def _get_issue_description_line(self, mark, default_url: str) -> str:
667666
issue_ids = self._get_issue_ids(mark)
668667
if not issue_ids:
669668
return mark.kwargs["reason"]
@@ -693,7 +692,7 @@ def _get_issue(self, mark: Mark) -> Optional[Issue]:
693692
issue_short_name = mark.kwargs["issue_type"]
694693

695694
# default value
696-
issue_short_name = "TI" if issue_short_name is None else issue_short_name
695+
issue_short_name = "TI" if issue_short_name is None else str(issue_short_name)
697696

698697
registered_issues = self.issue_types
699698
issue = None
@@ -824,7 +823,8 @@ def _process_attributes(self, item: Item) -> list[dict[str, Any]]:
824823
test_attributes = self._config.rp_tests_attributes
825824
if test_attributes:
826825
attributes = {
827-
(attr.get("key", None), attr["value"]) for attr in gen_attributes(self._config.rp_tests_attributes)
826+
(attr.get("key", None), attr["value"])
827+
for attr in gen_attributes(self._config.rp_tests_attributes or [])
828828
}
829829
else:
830830
attributes = set()
@@ -1420,7 +1420,7 @@ def start(self) -> None:
14201420
if self._config.rp_launch_uuid:
14211421
launch_id = self._config.rp_launch_uuid
14221422
self.rp = create_client(
1423-
client_type=self._config.rp_client_type or ClientType.SYNC,
1423+
client_type=self._config.rp_client_type,
14241424
endpoint=self._config.rp_endpoint,
14251425
project=self._config.rp_project,
14261426
api_key=self._config.rp_api_key,
@@ -1431,7 +1431,7 @@ def start(self) -> None:
14311431
launch_uuid=launch_id,
14321432
log_batch_payload_limit=self._config.rp_log_batch_payload_limit,
14331433
launch_uuid_print=self._config.rp_launch_uuid_print,
1434-
print_output=self._config.rp_launch_uuid_print_output,
1434+
print_output=self._config.rp_launch_uuid_print_output or OutputType.STDOUT,
14351435
http_timeout=self._config.rp_http_timeout,
14361436
mode=self._config.rp_mode,
14371437
# OAuth 2.0 parameters

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
dill>=0.3.6
21
pytest>=4.6.10
32
delayed-assert
43
pytest-cov

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
reportportal-client==5.7.1
2-
aenum==3.1.17
1+
reportportal-client==5.7.2

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from setuptools import setup
1919

20-
__version__ = "5.6.2"
20+
__version__ = "5.6.3"
2121

2222

2323
def read_file(fname):

tests/integration/test_config_handling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_launch_uuid_print(mock_client_init):
214214
assert int(result) == 0, "Exit code should be 0 (no errors)"
215215
expect(mock_client_init.call_count == 1)
216216
expect(mock_client_init.call_args_list[0][1]["launch_uuid_print"] == print_uuid)
217-
expect(mock_client_init.call_args_list[0][1]["print_output"] is None)
217+
expect(mock_client_init.call_args_list[0][1]["print_output"] is OutputType.STDOUT)
218218
assert_expectations()
219219

220220

@@ -248,7 +248,7 @@ def test_no_launch_uuid_print(mock_client_init):
248248
assert int(result) == 0, "Exit code should be 0 (no errors)"
249249
expect(mock_client_init.call_count == 1)
250250
expect(mock_client_init.call_args_list[0][1]["launch_uuid_print"] is False)
251-
expect(mock_client_init.call_args_list[0][1]["print_output"] is None)
251+
expect(mock_client_init.call_args_list[0][1]["print_output"] is OutputType.STDOUT)
252252
assert_expectations()
253253

254254

0 commit comments

Comments
 (0)