Skip to content

Commit

Permalink
Resolve multiple locations for files in github runner
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelbray32 committed Aug 23, 2023
1 parent 8b3b70e commit 0be5382
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/spikegadgets_to_nwb/tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from spikegadgets_to_nwb.convert import create_nwbs, _create_nwb

import os
import pandas as pd
from pathlib import Path
from pynwb import NWBHDF5IO

Expand Down Expand Up @@ -43,25 +44,32 @@ def test_convert():
try:
# running on github
data_path = Path(os.environ.get("DOWNLOAD_DIR"))
yml_data_path = Path(path + "/test_data")
yml_path_df = get_file_info(yml_data_path)
yml_path_df = yml_path_df[yml_path_df.file_extension == ".yml"]
append_yml_df = True
except (TypeError, FileNotFoundError):
# running locally
data_path = Path(path + "/test_data")
append_yml_df = False
probe_metadata = [Path(path + "/test_data/tetrode_12.5.yml")]

# make session_df
path_df = get_file_info(data_path)
if append_yml_df:
path_df = pd.concat([path_df, yml_path_df])
path_df = path_df[
path_df.full_path
!= data_path.as_posix() + "/20230622_sample_metadataProbeReconfig.yml"
]
session_df = path_df[(path_df.animal == "sample")]
assert len(session_df[session_df.file_extension == ".yml"]) == 1
# _create_nwb(
# session=("20230622", "sample", "1"),
# session_df=session_df,
# probe_metadata_paths=probe_metadata,
# output_dir=str(data_path),
# )
_create_nwb(
session=("20230622", "sample", "1"),
session_df=session_df,
probe_metadata_paths=probe_metadata,
output_dir=str(data_path),
)
assert "sample20230622.nwb" in os.listdir(str(data_path))
with NWBHDF5IO(str(data_path) + "/sample20230622.nwb") as io:
nwbfile = io.read()
Expand Down

0 comments on commit 0be5382

Please sign in to comment.