def test_all_filenames(self): """Test to see if renaming works on all filenames""" files = loadfn(os.path.join(TEST_FILE_DIR, "test_filenames.json")) with ScratchDir("."): os.environ["BEEP_PROCESSING_DIR"] = os.getcwd() os.mkdir("data-share") os.mkdir(os.path.join("data-share", "raw_cycler_files")) os.mkdir(os.path.join("data-share", "renamed_cycler_files")) # filter for only files with protocol in name files = [file for file in files if "batch8" not in file] for filename in files: Path(os.path.join("data-share", "raw_cycler_files", filename)).touch() process_files_json() pass # to exit scratch dir context
def test_all_filenames(self): """Test to see if renaming works on all filenames""" files = loadfn(os.path.join(TEST_FILE_DIR, 'test_filenames.json')) source_directory = os.path.join(TEST_FILE_DIR) for filename in files: params = get_parameters_fastcharge(filename, source_directory) with ScratchDir('.'): os.environ["BEEP_ROOT"] = os.getcwd() os.mkdir("data-share") os.mkdir(os.path.join("data-share", "raw_cycler_files")) os.mkdir(os.path.join("data-share", "renamed_cycler_files")) #filter for only files with protocol in name files = [file for file in files if "batch8" not in file] for filename in files: Path(os.path.join("data-share", "raw_cycler_files", filename)).touch() process_files_json() pass # to exit scratch dir context
def test_python(self): """Python script for end to end test""" # Copy mapped = collate.process_files_json() rename_output = json.loads(mapped) rename_output['mode'] = self.events_mode # mode run|test|events_off rename_output['run_list'] = list(range(len( rename_output['file_list']))) mapped = json.dumps(rename_output) # Validation validated = validate.validate_file_list_from_json(mapped) validated_output = json.loads(validated) validated_output['mode'] = self.events_mode # mode run|test|events_off validated_output['run_list'] = list( range(len(validated_output['file_list']))) validated = json.dumps(validated_output) # Data structuring structured = structure.process_file_list_from_json(validated) structured_output = json.loads(structured) structured_output[ 'mode'] = self.events_mode # mode run|test|events_off structured_output['run_list'] = list( range(len(structured_output['file_list']))) structured = json.dumps(structured_output) # Featurization featurized = featurize.process_file_list_from_json(structured) featurized_output = json.loads(featurized) featurized_output[ 'mode'] = self.events_mode # mode run|test|events_off featurized_output['run_list'] = list( range(len(featurized_output['file_list']))) featurized = json.dumps(featurized_output) # Prediction predictions = run_model.process_file_list_from_json( featurized, model_dir=MODEL_DIR) # Validate output files self._check_result_file_validity()