Skip to content

Commit 3dc6dec

Browse files
authored
Merge pull request #413 from reportportal/develop
Release
2 parents e696b72 + d07bbde commit 3dc6dec

9 files changed

Lines changed: 51 additions & 19 deletions

File tree

CHANGELOG.md

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

33
## [Unreleased]
44
### Added
5+
- `rp_launch_uuid` configuration parameter, by @HardNorth
6+
- `rp_launch_attributes` cmd argument, by @fahadnaeemkhan
7+
### Changed
8+
- Client version updated on [5.7.1](https://github.com/reportportal/client-Python/releases/tag/5.7.1), by @HardNorth
9+
10+
## [5.6.1]
11+
### Added
512
- Config variables override by environment variables logic, by @HardNorth
613
### Fixed
714
- Code reference generation in `xdist`, by @Sgitario

pytest_reportportal/config.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AgentConfig:
4444
rp_bts_project: str
4545
rp_bts_url: str
4646
rp_launch: str
47-
rp_launch_id: Optional[str]
47+
rp_launch_uuid: Optional[str]
4848
rp_launch_attributes: Optional[list[str]]
4949
rp_tests_attributes: Optional[list[str]]
5050
rp_launch_description: str
@@ -105,7 +105,16 @@ def __init__(self, pytest_config: Config) -> None:
105105
self.rp_bts_project = self.find_option(pytest_config, "rp_bts_project")
106106
self.rp_bts_url = self.find_option(pytest_config, "rp_bts_url")
107107
self.rp_launch = self.find_option(pytest_config, "rp_launch")
108-
self.rp_launch_id = self.find_option(pytest_config, "rp_launch_id")
108+
self.rp_launch_uuid = self.find_option(pytest_config, "rp_launch_id")
109+
if self.rp_launch_uuid:
110+
warnings.warn(
111+
"Parameter `rp_launch_id` is deprecated since 5.6.2 and will be subject for removing"
112+
"in the next major version. Use `rp_launch_uuid` argument instead.",
113+
DeprecationWarning,
114+
2,
115+
)
116+
self.rp_launch_uuid = self.find_option(pytest_config, "rp_launch_uuid", self.rp_launch_uuid)
117+
109118
self.rp_launch_attributes = self.find_option(pytest_config, "rp_launch_attributes")
110119
self.rp_tests_attributes = self.find_option(pytest_config, "rp_tests_attributes")
111120
self.rp_launch_description = self.find_option(pytest_config, "rp_launch_description")

pytest_reportportal/plugin.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def wait_launch(rp_client: RP) -> bool:
8686
:param rp_client: Instance of the ReportPortalService class
8787
"""
8888
timeout = time.time() + LAUNCH_WAIT_TIMEOUT
89-
while not rp_client.launch_id:
89+
while not rp_client.launch_uuid:
9090
if time.time() > timeout:
9191
return False
9292
time.sleep(1)
@@ -531,7 +531,11 @@ def add_shared_option(name, help_str, default=None, action="store"):
531531
)
532532
add_shared_option(
533533
name="rp_launch_id",
534-
help_str="Use already existing launch-id. The plugin won't control " "the Launch status",
534+
help_str="DEPRECATED: Use already existing launch-id. The plugin won't control the Launch status",
535+
)
536+
add_shared_option(
537+
name="rp_launch_uuid",
538+
help_str="Use already existing launch UUID. The plugin won't control the Launch status",
535539
)
536540
add_shared_option(
537541
name="rp_launch_description",
@@ -590,8 +594,16 @@ def add_shared_option(name, help_str, default=None, action="store"):
590594
parser.addini("rp_oauth_client_secret", type="args", help="OAuth 2.0 client secret")
591595
parser.addini("rp_oauth_scope", type="args", help="OAuth 2.0 access token scope")
592596

593-
parser.addini("rp_launch_attributes", type="args", help="Launch attributes, i.e Performance Regression")
594-
parser.addini("rp_tests_attributes", type="args", help="Attributes for all tests items, e.g. Smoke")
597+
rp_launch_attributes_help_str = "Launch attributes, i.e Performance Regression."
598+
parser.addini("rp_launch_attributes", type="args", help=rp_launch_attributes_help_str)
599+
group.addoption(
600+
"--rp-launch-attributes", dest="rp_launch_attributes", help=rp_launch_attributes_help_str, nargs="+"
601+
)
602+
603+
rp_test_attributes_help_str = "Attributes for all tests items, e.g. Smoke."
604+
parser.addini("rp_tests_attributes", type="args", help=rp_test_attributes_help_str)
605+
group.addoption("--rp-tests-attributes", dest="rp_tests_attributes", help=rp_test_attributes_help_str, nargs="+")
606+
595607
parser.addini("rp_log_batch_size", default="20", help="Size of batch log requests in async mode")
596608
parser.addini(
597609
"rp_log_batch_payload_limit",

pytest_reportportal/service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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, create_client
77+
from reportportal_client import RP, ClientType, 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__)
@@ -1417,10 +1417,10 @@ def start(self) -> None:
14171417
self._config.rp_api_key,
14181418
)
14191419
launch_id = self._launch_id
1420-
if self._config.rp_launch_id:
1421-
launch_id = self._config.rp_launch_id
1420+
if self._config.rp_launch_uuid:
1421+
launch_id = self._config.rp_launch_uuid
14221422
self.rp = create_client(
1423-
client_type=self._config.rp_client_type,
1423+
client_type=self._config.rp_client_type or ClientType.SYNC,
14241424
endpoint=self._config.rp_endpoint,
14251425
project=self._config.rp_project,
14261426
api_key=self._config.rp_api_key,

requirements-dev.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
dill>=0.3.6
2+
pytest>=4.6.10
13
delayed-assert
24
pytest-cov
35
pytest-parallel
46
black
57
isort
6-
mypy
8+
mypy==1.19.1

requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
dill>=0.3.6
2-
pytest>=4.6.10
3-
reportportal-client~=5.7.0
4-
aenum>=3.1.0
1+
reportportal-client==5.7.1
2+
aenum==3.1.17

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.1"
20+
__version__ = "5.6.2"
2121

2222

2323
def read_file(fname):

tests/unit/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_verify_ssl_true(mocked_config, verify_ssl, expected_result):
4343
("RP_PROJECT", "env_project", "rp_project", "env_project"),
4444
("RP_LAUNCH", "env_launch", "rp_launch", "env_launch"),
4545
("RP_API_KEY", "env_api_key", "rp_api_key", "env_api_key"),
46-
("RP_LAUNCH_ID", "env_launch_id", "rp_launch_id", "env_launch_id"),
46+
("RP_LAUNCH_UUID", "env_launch_id", "rp_launch_uuid", "env_launch_id"),
4747
("RP_MODE", "DEBUG", "rp_mode", "DEBUG"),
4848
("RP_PARENT_ITEM_ID", "env_parent_id", "rp_parent_item_id", "env_parent_id"),
4949
("RP_RERUN_OF", "env_rerun_of", "rp_rerun_of", "env_rerun_of"),

tests/unit/test_plugin.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def test_wait_launch(time_mock):
146146
"""Test wait_launch() function for the correct behavior."""
147147
time_mock.time.side_effect = [0, 1, 2]
148148
rp_client = mock.Mock()
149-
rp_client.launch_id = None
149+
rp_client.launch_uuid = None
150150
assert not wait_launch(rp_client)
151151

152152

@@ -224,7 +224,7 @@ def test_pytest_sessionfinish(mocked_session):
224224
:param mocked_session: pytest fixture
225225
"""
226226
mocked_session.config.py_test_service = mock.Mock()
227-
mocked_session.config._reporter_config.rp_launch_id = None
227+
mocked_session.config._reporter_config.rp_launch_uuid = None
228228
pytest_sessionfinish(mocked_session)
229229
assert mocked_session.config.py_test_service.finish_launch.called
230230

@@ -235,6 +235,7 @@ def test_pytest_addoption_adds_correct_ini_file_arguments():
235235
expected_argument_names = (
236236
"rp_launch",
237237
"rp_launch_id",
238+
"rp_launch_uuid",
238239
"rp_launch_description",
239240
"rp_project",
240241
"rp_log_level",
@@ -295,6 +296,7 @@ def test_pytest_addoption_adds_correct_command_line_arguments():
295296
"--reportportal",
296297
"--rp-launch",
297298
"--rp-launch-id",
299+
"--rp-launch-uuid",
298300
"--rp-launch-description",
299301
"--rp-project",
300302
"--rp-log-level",
@@ -308,6 +310,8 @@ def test_pytest_addoption_adds_correct_command_line_arguments():
308310
"--rp-thread-logging",
309311
"--rp-launch-uuid-print",
310312
"--rp-launch-uuid-print-output",
313+
"--rp-launch-attributes",
314+
"--rp-tests-attributes",
311315
)
312316
mock_parser = mock.MagicMock(spec=Parser)
313317
mock_reporting_group = mock_parser.getgroup.return_value

0 commit comments

Comments
 (0)