1919
2020from _pytest .config import Config
2121from reportportal_client import OutputType , ClientType
22- from reportportal_client .logs import MAX_LOG_BATCH_PAYLOAD_SIZE
2322from reportportal_client .helpers import to_bool
23+ from reportportal_client .logs import MAX_LOG_BATCH_PAYLOAD_SIZE
2424
2525try :
2626 # This try/except can go away once we support pytest >= 5.4.0
@@ -72,26 +72,16 @@ class AgentConfig:
7272
7373 def __init__ (self , pytest_config : Config ) -> None :
7474 """Initialize required attributes."""
75- self .rp_rerun = (pytest_config .option .rp_rerun or
76- pytest_config .getini ('rp_rerun' ))
75+ self .rp_rerun = (pytest_config .option .rp_rerun or pytest_config .getini ('rp_rerun' ))
7776 self .rp_endpoint = self .find_option (pytest_config , 'rp_endpoint' )
78- self .rp_hierarchy_code = self .find_option (pytest_config ,
79- 'rp_hierarchy_code' )
80- self .rp_dir_level = int (self .find_option (pytest_config ,
81- 'rp_hierarchy_dirs_level' ))
82- self .rp_hierarchy_dirs = self .find_option (pytest_config ,
83- 'rp_hierarchy_dirs' )
84- self .rp_display_suite_test_file = self .find_option (pytest_config ,
85- 'rp_display_suite_test_file' )
86- self .rp_dir_path_separator = \
87- self .find_option (pytest_config , 'rp_hierarchy_dir_path_separator' )
77+ self .rp_hierarchy_code = self .find_option (pytest_config , 'rp_hierarchy_code' )
78+ self .rp_dir_level = int (self .find_option (pytest_config , 'rp_hierarchy_dirs_level' ))
79+ self .rp_hierarchy_dirs = self .find_option (pytest_config , 'rp_hierarchy_dirs' )
80+ self .rp_display_suite_test_file = self .find_option (pytest_config , 'rp_display_suite_test_file' )
81+ self .rp_dir_path_separator = self .find_option (pytest_config , 'rp_hierarchy_dir_path_separator' )
8882 self .rp_ignore_attributes = set (self .find_option (pytest_config , 'rp_ignore_attributes' ) or [])
89- self .rp_is_skipped_an_issue = self .find_option (
90- pytest_config ,
91- 'rp_is_skipped_an_issue'
92- )
93- self .rp_issue_id_marks = self .find_option (pytest_config ,
94- 'rp_issue_id_marks' )
83+ self .rp_is_skipped_an_issue = self .find_option (pytest_config , 'rp_is_skipped_an_issue' )
84+ self .rp_issue_id_marks = self .find_option (pytest_config , 'rp_issue_id_marks' )
9585 self .rp_bts_issue_url = self .find_option (pytest_config , 'rp_bts_issue_url' )
9686 if not self .rp_bts_issue_url :
9787 self .rp_bts_issue_url = self .find_option (pytest_config , 'rp_issue_system_url' )
@@ -106,14 +96,10 @@ def __init__(self, pytest_config: Config) -> None:
10696 self .rp_bts_url = self .find_option (pytest_config , 'rp_bts_url' )
10797 self .rp_launch = self .find_option (pytest_config , 'rp_launch' )
10898 self .rp_launch_id = self .find_option (pytest_config , 'rp_launch_id' )
109- self .rp_launch_attributes = self .find_option (pytest_config ,
110- 'rp_launch_attributes' )
111- self .rp_launch_description = self .find_option (pytest_config ,
112- 'rp_launch_description' )
113- self .rp_log_batch_size = int (self .find_option (pytest_config ,
114- 'rp_log_batch_size' ))
115- batch_payload_size = self .find_option (
116- pytest_config , 'rp_log_batch_payload_size' )
99+ self .rp_launch_attributes = self .find_option (pytest_config , 'rp_launch_attributes' )
100+ self .rp_launch_description = self .find_option (pytest_config , 'rp_launch_description' )
101+ self .rp_log_batch_size = int (self .find_option (pytest_config , 'rp_log_batch_size' ))
102+ batch_payload_size = self .find_option (pytest_config , 'rp_log_batch_payload_size' )
117103 if batch_payload_size :
118104 self .rp_log_batch_payload_size = int (batch_payload_size )
119105 else :
@@ -122,16 +108,10 @@ def __init__(self, pytest_config: Config) -> None:
122108 self .rp_log_format = self .find_option (pytest_config , 'rp_log_format' )
123109 self .rp_thread_logging = to_bool (self .find_option (pytest_config , 'rp_thread_logging' ) or False )
124110 self .rp_mode = self .find_option (pytest_config , 'rp_mode' )
125- self .rp_parent_item_id = self .find_option (pytest_config ,
126- 'rp_parent_item_id' )
127- self .rp_project = self .find_option (pytest_config ,
128- 'rp_project' )
129- self .rp_rerun_of = self .find_option (pytest_config ,
130- 'rp_rerun_of' )
131- self .rp_skip_connection_test = str (
132- self .find_option (pytest_config ,
133- 'rp_skip_connection_test' )).lower () in (
134- 'true' , '1' , 'yes' , 'y' )
111+ self .rp_parent_item_id = self .find_option (pytest_config , 'rp_parent_item_id' )
112+ self .rp_project = self .find_option (pytest_config , 'rp_project' )
113+ self .rp_rerun_of = self .find_option (pytest_config , 'rp_rerun_of' )
114+ self .rp_skip_connection_test = to_bool (self .find_option (pytest_config , 'rp_skip_connection_test' ))
135115
136116 rp_api_retries_str = self .find_option (pytest_config , 'rp_api_retries' )
137117 rp_api_retries = rp_api_retries_str and int (rp_api_retries_str )
@@ -182,8 +162,7 @@ def __init__(self, pytest_config: Config) -> None:
182162 self .rp_verify_ssl = to_bool (rp_verify_ssl )
183163 except (ValueError , AttributeError ):
184164 self .rp_verify_ssl = rp_verify_ssl
185- self .rp_launch_timeout = int (
186- self .find_option (pytest_config , 'rp_launch_timeout' ))
165+ self .rp_launch_timeout = int (self .find_option (pytest_config , 'rp_launch_timeout' ))
187166
188167 self .rp_launch_uuid_print = to_bool (self .find_option (pytest_config , 'rp_launch_uuid_print' ) or 'False' )
189168 print_output = self .find_option (pytest_config , 'rp_launch_uuid_print_output' )
@@ -218,10 +197,7 @@ def find_option(self, pytest_config: Config, option_name: str, default: Any = No
218197 :param default: value to be returned if not found
219198 :return: option value
220199 """
221- value = (
222- getattr (pytest_config .option , option_name , None ) or
223- pytest_config .getini (option_name )
224- )
200+ value = (getattr (pytest_config .option , option_name , None ) or pytest_config .getini (option_name ))
225201 if isinstance (value , bool ):
226202 return value
227203 return value or default
0 commit comments