Skip to content

Commit 89bb79c

Browse files
Skip tests if ConnectionError
1 parent 0574d96 commit 89bb79c

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

tests/test_download.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99

1010

1111
def test_neuromorpho_download(tmpdir):
12-
api = NeuroMorpOrgAPI(base_dir=tmpdir)
12+
try:
13+
api = NeuroMorpOrgAPI(base_dir=tmpdir)
14+
except ConnectionError as e:
15+
pytest.skip(
16+
"Skipping Neuromorpho tests due to connection error: {}".format(e)
17+
)
18+
return
19+
1320
cache_path = Path(api.neuromorphorg_cache)
1421

1522
# Test get_fields_values
@@ -91,7 +98,13 @@ def test_mouselight_download(tmpdir):
9198
)
9299
neurons_metadata = sorted(neurons_metadata, key=lambda x: x["idString"])
93100

94-
neurons = mlapi.download_neurons(neurons_metadata[0])
101+
try:
102+
neurons = mlapi.download_neurons(neurons_metadata[0])
103+
except ConnectionError as e:
104+
pytest.skip(
105+
"Skipping MouseLight tests due to connection error: {}".format(e)
106+
)
107+
return
95108

96109
neurons = [neuron.create_mesh()[1] for neuron in neurons]
97110

@@ -105,7 +118,13 @@ def test_mouselight_download(tmpdir):
105118

106119
# Test failure
107120
neurons_metadata[0]["idString"] = "BAD ID"
108-
neurons = mlapi.download_neurons(neurons_metadata[0])
121+
try:
122+
neurons = mlapi.download_neurons(neurons_metadata[0])
123+
except ConnectionError as e:
124+
pytest.skip(
125+
"Skipping MouseLight failure test due to error: {}".format(e)
126+
)
127+
return
109128

110129
assert neurons[0].data_file.name == "BAD ID.swc"
111130
assert neurons[0].points is None

0 commit comments

Comments
 (0)