Skip to content

Commit 4f93065

Browse files
author
Cody Baker
committed
fix for conda
1 parent 9ccef84 commit 4f93065

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

tests/test_testing_module.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ def test_update_testing_config():
55
test_key = "LOCAL_PATH"
66
test_value = "/a/new/path/"
77

8-
initial_testing_config = load_testing_config()
98
try:
10-
update_testing_config(key=test_key, value=test_value)
11-
updated_testing_config = load_testing_config()
12-
finally:
13-
# Restore
14-
update_testing_config(key=test_key, value=initial_testing_config[test_key])
9+
initial_testing_config = load_testing_config()
10+
NO_CONFIG = False # Depending on the method of installation, a config may not have generated
11+
except FileNotFoundError:
12+
NO_CONFIG = True
1513

16-
assert updated_testing_config[test_key] != initial_testing_config[test_key]
17-
assert updated_testing_config[test_key] == test_value
14+
if not NO_CONFIG:
15+
try:
16+
update_testing_config(key=test_key, value=test_value)
17+
updated_testing_config = load_testing_config()
18+
finally:
19+
# Restore
20+
update_testing_config(key=test_key, value=initial_testing_config[test_key])
21+
22+
assert updated_testing_config[test_key] != initial_testing_config[test_key]
23+
assert updated_testing_config[test_key] == test_value

tests/unit_tests/test_image_series.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414
)
1515
from nwbinspector.testing import load_testing_config
1616

17-
testing_config = load_testing_config()
18-
testing_file = Path(testing_config["LOCAL_PATH"]) / "image_series_testing_file.nwb"
17+
try:
18+
testing_config = load_testing_config()
19+
testing_file = Path(testing_config["LOCAL_PATH"]) / "image_series_testing_file.nwb"
20+
NO_CONFIG = False # Depending on the method of installation, a config may not have generated
21+
except FileNotFoundError:
22+
testing_file = "Not found"
23+
NO_CONFIG = True
1924

2025

2126
@unittest.skipIf(
22-
not testing_file.exists(),
27+
NO_CONFIG or not testing_file.exists(),
2328
reason=f"The ImageSeries unit tests were skipped because the required file ({testing_file}) was not found!",
2429
)
2530
class TestExternalFileValid(unittest.TestCase):
@@ -47,9 +52,7 @@ def test_check_image_series_external_file_valid_bytestring_pass(self):
4752
"""Can't use the NWB file since the call to io.write() decodes the bytes with modern versions of h5py."""
4853
good_external_path = Path(self.nwbfile.acquisition["TestImageSeriesGoodExternalPaths"].external_file[0])
4954
image_series = ImageSeries(
50-
name="TestImageSeries",
51-
rate=1.0,
52-
external_file=[bytes("/".join([".", good_external_path.name]), "utf-8")],
55+
name="TestImageSeries", rate=1.0, external_file=[bytes("/".join([".", good_external_path.name]), "utf-8")],
5356
)
5457
assert check_image_series_external_file_relative(image_series=image_series) is None
5558

0 commit comments

Comments
 (0)