|
14 | 14 | """This module contains class that stores RP agent configuration data.""" |
15 | 15 |
|
16 | 16 | import warnings |
17 | | -from distutils.util import strtobool |
18 | 17 | from os import getenv |
19 | 18 | from typing import Optional, Union, Any, Tuple |
20 | 19 |
|
21 | 20 | from _pytest.config import Config |
22 | 21 | from reportportal_client import OutputType, ClientType |
23 | 22 | from reportportal_client.logs import MAX_LOG_BATCH_PAYLOAD_SIZE |
| 23 | +from reportportal_client.helpers import to_bool |
24 | 24 |
|
25 | 25 | try: |
26 | 26 | # This try/except can go away once we support pytest >= 5.4.0 |
@@ -116,9 +116,7 @@ def __init__(self, pytest_config: Config) -> None: |
116 | 116 | self.rp_log_batch_payload_size = MAX_LOG_BATCH_PAYLOAD_SIZE |
117 | 117 | self.rp_log_level = get_actual_log_level(pytest_config, 'rp_log_level') |
118 | 118 | self.rp_log_format = self.find_option(pytest_config, 'rp_log_format') |
119 | | - self.rp_thread_logging = bool(strtobool(str(self.find_option( |
120 | | - pytest_config, 'rp_thread_logging' |
121 | | - ) or False))) |
| 119 | + self.rp_thread_logging = to_bool(self.find_option(pytest_config, 'rp_thread_logging') or False) |
122 | 120 | self.rp_mode = self.find_option(pytest_config, 'rp_mode') |
123 | 121 | self.rp_parent_item_id = self.find_option(pytest_config, |
124 | 122 | 'rp_parent_item_id') |
@@ -177,15 +175,13 @@ def __init__(self, pytest_config: Config) -> None: |
177 | 175 |
|
178 | 176 | rp_verify_ssl = self.find_option(pytest_config, 'rp_verify_ssl', True) |
179 | 177 | try: |
180 | | - self.rp_verify_ssl = bool(strtobool(rp_verify_ssl)) |
| 178 | + self.rp_verify_ssl = to_bool(rp_verify_ssl) |
181 | 179 | except (ValueError, AttributeError): |
182 | 180 | self.rp_verify_ssl = rp_verify_ssl |
183 | 181 | self.rp_launch_timeout = int( |
184 | 182 | self.find_option(pytest_config, 'rp_launch_timeout')) |
185 | 183 |
|
186 | | - self.rp_launch_uuid_print = bool(strtobool(self.find_option( |
187 | | - pytest_config, 'rp_launch_uuid_print' |
188 | | - ) or 'False')) |
| 184 | + self.rp_launch_uuid_print = to_bool(self.find_option(pytest_config, 'rp_launch_uuid_print') or 'False') |
189 | 185 | print_output = self.find_option(pytest_config, 'rp_launch_uuid_print_output') |
190 | 186 | self.rp_launch_uuid_print_output = OutputType[print_output.upper()] if print_output else None |
191 | 187 | client_type = self.find_option(pytest_config, 'rp_client_type') |
|
0 commit comments