def run(self, **kwargs): try: test_params = RapidTestManager.get_defaults() for key in kwargs: test_params[key] = kwargs[key] os.makedirs(self.res_dir, exist_ok=True) test_params['resultsdir'] = self.res_dir _, test_file_name = os.path.split(test_params['test_file']) _, environment_file_name = os.path.split( test_params['environment_file']) log_file = '{}/RUN{}.{}.log'.format(self.res_dir, environment_file_name, test_file_name) RapidLog.log_init(log_file, test_params['loglevel'], test_params['screenloglevel'], test_params['version']) test_manager = RapidTestManager() self.start_time = time.time() self.result, self.details = test_manager.run_tests(test_params) self.stop_time = time.time() RapidLog.log_close() except Exception: # pylint: disable=broad-except print("Unexpected error:", sys.exc_info()[0]) self.result = 0 self.stop_time = time.time()
def main(): """Main function. """ test_params = RapidTestManager.get_defaults() # When no cli is used, the process_cli can be replaced by code modifying # test_params test_params = RapidCli.process_cli(test_params) _, test_file_name = os.path.split(test_params['test_file']) _, environment_file_name = os.path.split(test_params['environment_file']) log_file = 'RUN{}.{}.log'.format(environment_file_name, test_file_name) RapidLog.log_init(log_file, test_params['loglevel'], test_params['screenloglevel'], test_params['version']) test_manager = RapidTestManager() test_result, _ = test_manager.run_tests(test_params) RapidLog.log_close()