@@ -90,12 +90,14 @@ def __init__(self, working_dir, cli_conf=None):
9090 self ._features_dir = os .path .join (self ._working_dir , 'features' )
9191 self ._steps_dir = os .path .join (self ._working_dir , 'steps' )
9292
93- tests_conf_path = self ._cli_conf . get ( CTFCliConfig . GLOBAL_SECTION_NAME ,
94- CTFCliConfig . CONFIG_TESTS_CONFIG_PATH )
95- if tests_conf_path is None :
96- self . _tests_conf_path = self . find_tests_config ( self . _project_tests_dir )
97- else :
93+ self . _tests_conf_path = self .find_tests_config ( self . _project_tests_dir )
94+ try :
95+ tests_conf_path = self . _cli_conf . get ( CTFCliConfig . GLOBAL_SECTION_NAME ,
96+ CTFCliConfig . CONFIG_TESTS_CONFIG_PATH )
97+ assert tests_conf_path
9898 self ._tests_conf_path = tests_conf_path
99+ except Exception :
100+ pass
99101
100102 if self ._tests_conf_path is not None :
101103 # keep the cli_conf object Up-To-Date
@@ -321,17 +323,37 @@ def run(self):
321323 Run Behave and pass some runtime arguments
322324 :return:
323325 """
326+ behave_data = None
327+ try :
328+ behave_data = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_BEHAVE_DATA )
329+ except Exception :
330+ pass
331+
332+ behave_tags = None
333+ try :
334+ behave_tags = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_BEHAVE_TAGS )
335+ except Exception :
336+ pass
324337
325- behave_data = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_BEHAVE_DATA )
326- behave_tags = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_BEHAVE_TAGS )
327- junit = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_JUNIT )
328- verbose = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_VERBOSE )
338+ junit = None
339+ try :
340+ junit = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_JUNIT )
341+ except Exception :
342+ pass
343+
344+ verbose = None
345+ try :
346+ verbose = self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_VERBOSE )
347+ except Exception :
348+ pass
329349
330350 # configuration file for ansible
331- if self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_EXEC_TYPE ) == 'ansible' :
332- ansible_conf = self ._working_dir_obj .exec_type_conf_path ()
333- else :
334- ansible_conf = None
351+ ansible_conf = None
352+ try :
353+ if self ._cli_conf_obj .get (CTFCliConfig .GLOBAL_SECTION_NAME , CTFCliConfig .CONFIG_EXEC_TYPE ) == 'ansible' :
354+ ansible_conf = self ._working_dir_obj .exec_type_conf_path ()
355+ except Exception :
356+ pass
335357
336358 command = [
337359 'behave'
0 commit comments