From f3dee1b3c0057082358b58ad9fdacdd4c1844f5c Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:45:19 -0400 Subject: [PATCH] fix scope --- ...ocker_yaml_conversion_specification_cli.py | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/docker_yaml_conversion_specification_cli.py b/tests/docker_yaml_conversion_specification_cli.py index b7d2ddb2b..9d2867be9 100644 --- a/tests/docker_yaml_conversion_specification_cli.py +++ b/tests/docker_yaml_conversion_specification_cli.py @@ -125,52 +125,52 @@ def test_run_conversion_from_yaml_default_nwbfile_name(self): assert "spike_times" in nwbfile.units -def test_run_conversion_from_yaml_variable(self): - path_to_test_yml_files = Path(__file__).parent / "conversion_specifications" - yaml_file_path = path_to_test_yml_files / "GIN_conversion_specification.yml" - - with open(file=yaml_file_path, mode="r") as io: - yaml_lines = io.readlines() - - yaml_string = "".join(yaml_lines) - os.environ["NEUROCONV_YAML"] = yaml_string - os.environ["NEUROCONV_DATA_PATH"] = DATA_PATH - os.environ["NEUROCONV_OUTPUT_PATH"] = OUTPUT_PATH - - deploy_process( - command=( - "docker run -t " f"--volume {self.source_volume}:/neuroconv ghcr.io/catalystneuro/neuroconv:yaml_variable" + def test_run_conversion_from_yaml_variable(self): + path_to_test_yml_files = Path(__file__).parent / "conversion_specifications" + yaml_file_path = path_to_test_yml_files / "GIN_conversion_specification.yml" + + with open(file=yaml_file_path, mode="r") as io: + yaml_lines = io.readlines() + + yaml_string = "".join(yaml_lines) + os.environ["NEUROCONV_YAML"] = yaml_string + os.environ["NEUROCONV_DATA_PATH"] = DATA_PATH + os.environ["NEUROCONV_OUTPUT_PATH"] = OUTPUT_PATH + + deploy_process( + command=( + "docker run -t " f"--volume {self.source_volume}:/neuroconv ghcr.io/catalystneuro/neuroconv:yaml_variable" + ) ) - ) - - nwbfile_path = self.test_folder / "example_converter_spec_1.nwb" - assert nwbfile_path.exists(), f"`run_conversion_from_yaml` failed to create the file at '{nwbfile_path}'! " - with NWBHDF5IO(path=nwbfile_path, mode="r") as io: - nwbfile = io.read() - assert nwbfile.session_description == "Subject navigating a Y-shaped maze." - assert nwbfile.lab == "My Lab" - assert nwbfile.institution == "My Institution" - assert nwbfile.session_start_time == datetime.fromisoformat("2020-10-09T21:19:09+00:00") - assert nwbfile.subject.subject_id == "1" - assert "ElectricalSeriesAP" in nwbfile.acquisition - - nwbfile_path = self.test_folder / "example_converter_spec_2.nwb" - assert nwbfile_path.exists(), f"`run_conversion_from_yaml` failed to create the file at '{nwbfile_path}'! " - with NWBHDF5IO(path=nwbfile_path, mode="r") as io: - nwbfile = io.read() - assert nwbfile.session_description == "Subject navigating a Y-shaped maze." - assert nwbfile.lab == "My Lab" - assert nwbfile.institution == "My Institution" - assert nwbfile.session_start_time == datetime.fromisoformat("2020-10-10T21:19:09+00:00") - assert nwbfile.subject.subject_id == "002" - - nwbfile_path = self.test_folder / "example_converter_spec_3.nwb" - assert nwbfile_path.exists(), f"`run_conversion_from_yaml` failed to create the file at '{nwbfile_path}'! " - with NWBHDF5IO(path=nwbfile_path, mode="r") as io: - nwbfile = io.read() - assert nwbfile.session_description == "Auto-generated by neuroconv" - assert nwbfile.lab == "My Lab" - assert nwbfile.institution == "My Institution" - assert nwbfile.session_start_time == datetime.fromisoformat("2020-10-11T21:19:09+00:00") - assert nwbfile.subject.subject_id == "Subject Name" - assert "spike_times" in nwbfile.units + + nwbfile_path = self.test_folder / "example_converter_spec_1.nwb" + assert nwbfile_path.exists(), f"`run_conversion_from_yaml` failed to create the file at '{nwbfile_path}'! " + with NWBHDF5IO(path=nwbfile_path, mode="r") as io: + nwbfile = io.read() + assert nwbfile.session_description == "Subject navigating a Y-shaped maze." + assert nwbfile.lab == "My Lab" + assert nwbfile.institution == "My Institution" + assert nwbfile.session_start_time == datetime.fromisoformat("2020-10-09T21:19:09+00:00") + assert nwbfile.subject.subject_id == "1" + assert "ElectricalSeriesAP" in nwbfile.acquisition + + nwbfile_path = self.test_folder / "example_converter_spec_2.nwb" + assert nwbfile_path.exists(), f"`run_conversion_from_yaml` failed to create the file at '{nwbfile_path}'! " + with NWBHDF5IO(path=nwbfile_path, mode="r") as io: + nwbfile = io.read() + assert nwbfile.session_description == "Subject navigating a Y-shaped maze." + assert nwbfile.lab == "My Lab" + assert nwbfile.institution == "My Institution" + assert nwbfile.session_start_time == datetime.fromisoformat("2020-10-10T21:19:09+00:00") + assert nwbfile.subject.subject_id == "002" + + nwbfile_path = self.test_folder / "example_converter_spec_3.nwb" + assert nwbfile_path.exists(), f"`run_conversion_from_yaml` failed to create the file at '{nwbfile_path}'! " + with NWBHDF5IO(path=nwbfile_path, mode="r") as io: + nwbfile = io.read() + assert nwbfile.session_description == "Auto-generated by neuroconv" + assert nwbfile.lab == "My Lab" + assert nwbfile.institution == "My Institution" + assert nwbfile.session_start_time == datetime.fromisoformat("2020-10-11T21:19:09+00:00") + assert nwbfile.subject.subject_id == "Subject Name" + assert "spike_times" in nwbfile.units