def get_file_name(self): """ create the name of the file for storing the query. the file is: {fixture_name}/{function_name}_{md5_on_url}(|_{call_number}).json if a custom_name is provided we take it, else we create a md5 on the url. a custom_name must be provided is the same call is done twice in the same test function """ mro = inspect.getmro(self.__class__) class_name = "Test{}".format(mro[1].__name__) scenario = mro[0].data_sets[0].scenario func_name = utils.get_calling_test_function() test_name = "{}/{}/{}".format(class_name, scenario, func_name) self.test_counter[test_name] += 1 if self.test_counter[test_name] > 1: return "{}_{}.json".format(test_name, self.test_counter[test_name] - 1) else: return "{}.json".format(test_name)
def send_and_wait(self, rt_file_name): """ Send a COTS and wait until the data is reloaded :param rt_file_name: name of the real-time feed file (obviously) """ if self.check_ref: return if len(self.data_sets) > 1: logger.warning(" >1 data_set for test class !!!") coverage = self.data_sets[0].name last_rt_data_loaded = self.get_last_rt_loaded_time(coverage) start_datetime = datetime.datetime.utcnow() self._send_cots(rt_file_name) cots_processing_time = datetime.datetime.utcnow() self.wait_for_rt_reload(last_rt_data_loaded, coverage) kraken_reloaded_time = datetime.datetime.utcnow() def round_time(beginning, end): return round((end - beginning).total_seconds(), 2) logger.info( "{test}: RT processed in {total}s (Kirin:{kirin}/Kraken:{kraken})". format( test=utils.get_calling_test_function(), total=round_time(start_datetime, kraken_reloaded_time), kirin=round_time(start_datetime, cots_processing_time), kraken=round_time(cots_processing_time, kraken_reloaded_time), ))
def get_reference_filename_prefix(self): """ When there is multiple calls to request_compare within one test function the name of the reference file for the first call is `func_name` For the (n+1)th call, the name of the reference file is `func_name_n` """ func_name = utils.get_calling_test_function() if self.nb_call_to_request_compare <= 1: return func_name else: assert self.nb_call_to_request_compare > 1 return "{}_{}".format(func_name, self.nb_call_to_request_compare - 1)
def get_file_name(self): """ create the name of the file for storing the query. the file is: {class_name}/{function_name}(|_{call_number}).json """ mro = inspect.getmro(self.__class__) class_name = "Test{}".format(mro[1].__name__) func_name = utils.get_calling_test_function() test_name = "{}/{}".format(class_name, func_name) self.test_counter[test_name] += 1 if self.test_counter[test_name] > 1: return "{}_{}.json".format(test_name, self.test_counter[test_name] - 1) else: return "{}.json".format(test_name)
def get_file_name(self): """ create the name of the file for storing the query. the file is: {fixture_name}/{function_name}_{md5_on_url}(|_{call_number}).json if a custom_name is provided we take it, else we create a md5 on the url. a custom_name must be provided is the same call is done twice in the same test function """ mro = inspect.getmro(self.__class__) class_name = "Test{}".format(mro[1].__name__) scenario = mro[0].data_sets[0].scenario func_name = utils.get_calling_test_function() test_name = '{}/{}/{}'.format(class_name, scenario, func_name) self.test_counter[test_name] += 1 if self.test_counter[test_name] > 1: return "{}_{}.json".format(test_name, self.test_counter[test_name] - 1) else: return "{}.json".format(test_name)