Skip to content

Commit 6520b06

Browse files
ayssar.mbayssar.mb
authored andcommitted
Check if dot binary exists
1 parent f300df9 commit 6520b06

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

testsuite/pytests/test_visualization.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040

4141
try:
4242
import pydot # noqa: F401
43+
import shutil
4344

44-
HAVE_PYDOT = True
45+
HAVE_PYDOT = shutil.which("dot") is not None
4546
except ImportError:
4647
HAVE_PYDOT = False
4748

@@ -92,7 +93,8 @@ def voltage_trace_verify(self, device):
9293
for ref_vm, line in zip((vm[::2], vm[1::2]), ax.lines):
9394
x_data, y_data = line.get_data()
9495
# Check that times are correct
95-
assert list(x_data) == list(np.unique(device.get("events", "times")))
96+
assert list(x_data) == list(
97+
np.unique(device.get("events", "times")))
9698
# Check that voltmeter data corresponds to the lines in the plot
9799
assert all(np.isclose(ref_vm, y_data))
98100
plt.close(ax.get_figure())
@@ -193,7 +195,8 @@ def test_raster_plot(self):
193195

194196
# Test extract_events
195197
all_extracted = nest.raster_plot.extract_events(data)
196-
times_30_to_40_extracted = nest.raster_plot.extract_events(data, time=[30.0, 40.0], sel=[3])
198+
times_30_to_40_extracted = nest.raster_plot.extract_events(
199+
data, time=[30.0, 40.0], sel=[3])
197200
source_2_extracted = nest.raster_plot.extract_events(data, sel=[2])
198201
assert np.array_equal(all_extracted, data)
199202
assert np.all(times_30_to_40_extracted[:, 1] >= 30.0)

0 commit comments

Comments
 (0)