Skip to content

Commit

Permalink
[MRG] fix GUI MPI test (#868)
Browse files Browse the repository at this point in the history
* test: added assertion that the dipole list is not empty in test_gui_run_simulation_mpi

Previously this test was passing with an empty dipole list. It was not checking any dipoles were actually created.

* test: changed test_gui_run_simulation_mpi to use the default network

-The test fixture network was not working with MPI. Presumably because the smaller network used in the fixture was not compatible with the multiprocessing subprocess call.

-We were encountering an error at the h.finitialize step of network_builder > _simulate_single_trial when using the fixture network. The error was within neuron: "NEURON: mindelay is 0 (or less than dt for fixed step method)".
  • Loading branch information
gtdang authored Aug 27, 2024
1 parent 157237c commit ccef332
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hnn_core/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,22 @@ def test_gui_init_network(setup_gui):

@requires_mpi4py
@requires_psutil
def test_gui_run_simulation_mpi(setup_gui):
def test_gui_run_simulation_mpi():
"""Test if run button triggers simulation with MPIBackend."""
gui = setup_gui
gui = HNNGUI()
_ = gui.compose()

gui.widget_tstop.value = 70
gui.widget_dt.value = 0.5
gui.widget_backend_selection.value = "MPI"
gui.widget_ntrials.value = 2
gui.run_button.click()

default_name = gui.widget_simulation_name.value
dpls = gui.simulation_data[default_name]['dpls']
assert isinstance(gui.simulation_data[default_name]["net"], Network)
assert isinstance(dpls, list)
assert len(dpls) > 0
assert all([isinstance(dpl, Dipole) for dpl in dpls])
plt.close('all')

Expand Down

0 comments on commit ccef332

Please sign in to comment.