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
@@ -40,6 +40,7 @@ class AgentConfig:
4040 rp_hierarchy_code : bool
4141 rp_dir_level : int
4242 rp_hierarchy_dirs : bool
43+ rp_hierarchy_test_file : bool
4344 rp_dir_path_separator : str
4445 rp_ignore_attributes : set
4546 rp_is_skipped_an_issue : bool
@@ -71,24 +72,16 @@ class AgentConfig:
7172
7273 def __init__ (self , pytest_config : Config ) -> None :
7374 """Initialize required attributes."""
74- self .rp_rerun = (pytest_config .option .rp_rerun or
75- pytest_config .getini ('rp_rerun' ))
75+ self .rp_rerun = (pytest_config .option .rp_rerun or pytest_config .getini ('rp_rerun' ))
7676 self .rp_endpoint = self .find_option (pytest_config , 'rp_endpoint' )
77- self .rp_hierarchy_code = self .find_option (pytest_config ,
78- 'rp_hierarchy_code' )
79- self .rp_dir_level = int (self .find_option (pytest_config ,
80- 'rp_hierarchy_dirs_level' ))
81- self .rp_hierarchy_dirs = self .find_option (pytest_config ,
82- 'rp_hierarchy_dirs' )
83- self .rp_dir_path_separator = \
84- self .find_option (pytest_config , 'rp_hierarchy_dir_path_separator' )
77+ self .rp_hierarchy_code = to_bool (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 = to_bool (self .find_option (pytest_config , 'rp_hierarchy_dirs' ))
80+ self .rp_dir_path_separator = self .find_option (pytest_config , 'rp_hierarchy_dir_path_separator' )
81+ self .rp_hierarchy_test_file = to_bool (self .find_option (pytest_config , 'rp_hierarchy_test_file' ))
8582 self .rp_ignore_attributes = set (self .find_option (pytest_config , 'rp_ignore_attributes' ) or [])
86- self .rp_is_skipped_an_issue = self .find_option (
87- pytest_config ,
88- 'rp_is_skipped_an_issue'
89- )
90- self .rp_issue_id_marks = self .find_option (pytest_config ,
91- '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' )
9285 self .rp_bts_issue_url = self .find_option (pytest_config , 'rp_bts_issue_url' )
9386 if not self .rp_bts_issue_url :
9487 self .rp_bts_issue_url = self .find_option (pytest_config , 'rp_issue_system_url' )
@@ -103,14 +96,10 @@ def __init__(self, pytest_config: Config) -> None:
10396 self .rp_bts_url = self .find_option (pytest_config , 'rp_bts_url' )
10497 self .rp_launch = self .find_option (pytest_config , 'rp_launch' )
10598 self .rp_launch_id = self .find_option (pytest_config , 'rp_launch_id' )
106- self .rp_launch_attributes = self .find_option (pytest_config ,
107- 'rp_launch_attributes' )
108- self .rp_launch_description = self .find_option (pytest_config ,
109- 'rp_launch_description' )
110- self .rp_log_batch_size = int (self .find_option (pytest_config ,
111- 'rp_log_batch_size' ))
112- batch_payload_size = self .find_option (
113- 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' )
114103 if batch_payload_size :
115104 self .rp_log_batch_payload_size = int (batch_payload_size )
116105 else :
@@ -119,16 +108,10 @@ def __init__(self, pytest_config: Config) -> None:
119108 self .rp_log_format = self .find_option (pytest_config , 'rp_log_format' )
120109 self .rp_thread_logging = to_bool (self .find_option (pytest_config , 'rp_thread_logging' ) or False )
121110 self .rp_mode = self .find_option (pytest_config , 'rp_mode' )
122- self .rp_parent_item_id = self .find_option (pytest_config ,
123- 'rp_parent_item_id' )
124- self .rp_project = self .find_option (pytest_config ,
125- 'rp_project' )
126- self .rp_rerun_of = self .find_option (pytest_config ,
127- 'rp_rerun_of' )
128- self .rp_skip_connection_test = str (
129- self .find_option (pytest_config ,
130- 'rp_skip_connection_test' )).lower () in (
131- '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' ))
132115
133116 rp_api_retries_str = self .find_option (pytest_config , 'rp_api_retries' )
134117 rp_api_retries = rp_api_retries_str and int (rp_api_retries_str )
@@ -179,8 +162,7 @@ def __init__(self, pytest_config: Config) -> None:
179162 self .rp_verify_ssl = to_bool (rp_verify_ssl )
180163 except (ValueError , AttributeError ):
181164 self .rp_verify_ssl = rp_verify_ssl
182- self .rp_launch_timeout = int (
183- self .find_option (pytest_config , 'rp_launch_timeout' ))
165+ self .rp_launch_timeout = int (self .find_option (pytest_config , 'rp_launch_timeout' ))
184166
185167 self .rp_launch_uuid_print = to_bool (self .find_option (pytest_config , 'rp_launch_uuid_print' ) or 'False' )
186168 print_output = self .find_option (pytest_config , 'rp_launch_uuid_print_output' )
@@ -215,10 +197,7 @@ def find_option(self, pytest_config: Config, option_name: str, default: Any = No
215197 :param default: value to be returned if not found
216198 :return: option value
217199 """
218- value = (
219- getattr (pytest_config .option , option_name , None ) or
220- pytest_config .getini (option_name )
221- )
200+ value = (getattr (pytest_config .option , option_name , None ) or pytest_config .getini (option_name ))
222201 if isinstance (value , bool ):
223202 return value
224203 return value or default
0 commit comments