From ccef332d3190a6a7338703c74641abd817d3056d Mon Sep 17 00:00:00 2001 From: George Dang <53052793+gtdang@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:23:45 -0400 Subject: [PATCH] [MRG] fix GUI MPI test (#868) * 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)". --- hnn_core/tests/test_gui.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hnn_core/tests/test_gui.py b/hnn_core/tests/test_gui.py index d10968ca0..03cb110ef 100644 --- a/hnn_core/tests/test_gui.py +++ b/hnn_core/tests/test_gui.py @@ -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')