diff --git a/test/coreneuron/test_netmove.py b/test/coreneuron/test_netmove.py index 5cbe1858e9..817d2c69ca 100644 --- a/test/coreneuron/test_netmove.py +++ b/test/coreneuron/test_netmove.py @@ -46,7 +46,7 @@ def result(self): return (self.syn.n_netsend, self.syn.n_netmove, self.msgvec.c()) -def test_netmove(): +def _test_netmove(): from neuron import coreneuron coreneuron.enable = False @@ -111,10 +111,10 @@ def runassert(mode): return stdlist -if __name__ == "__main__": +def test_netmove(): from neuron import gui - stdlist = test_netmove() + stdlist = _test_netmove() g = h.Graph() print("n_netsend n_netmove") for result in stdlist: @@ -122,3 +122,7 @@ def runassert(mode): result[2].line(g) g.exec_menu("View = plot") h.quit() + + +if __name__ == "__main__": + test_netmove() diff --git a/test/coreneuron/test_spikes.py b/test/coreneuron/test_spikes.py index cecb8a3d0e..883609c16b 100644 --- a/test/coreneuron/test_spikes.py +++ b/test/coreneuron/test_spikes.py @@ -28,7 +28,7 @@ from neuron import h, gui -def test_spikes( +def _test_spikes( use_mpi4py=mpi4py_option, use_nrnmpi_init=nrnmpi_init_option, file_mode=file_mode_option, @@ -132,9 +132,13 @@ def run(mode): return h -if __name__ == "__main__": - h = test_spikes() +def test_spikes(): + result = _test_spikes() if mpi4py_option or nrnmpi_init_option: pc = h.ParallelContext() pc.barrier() - h.quit() + result.quit() + + +if __name__ == "__main__": + test_spikes() diff --git a/test/gjtests/test_natrans.py b/test/gjtests/test_natrans.py index 53077d1cd5..c01acf7530 100644 --- a/test/gjtests/test_natrans.py +++ b/test/gjtests/test_natrans.py @@ -36,7 +36,7 @@ ) -def test_natrans(): +def _test_natrans(): gids = [gid for gid in range(rank, ncell, nhost)] cells = [] for gid in range(rank, ncell, nhost): @@ -115,7 +115,11 @@ def run(): return cells, gids, sgids, targets -if __name__ == "__main__": - model = test_natrans() +def test_natrans(): + model = _test_natrans() pc.barrier() h.quit() + + +if __name__ == "__main__": + test_natrans() diff --git a/test/pytest_coreneuron/test_nlayer.py b/test/pytest_coreneuron/test_nlayer.py index 5a7670da58..5defbf4d68 100644 --- a/test/pytest_coreneuron/test_nlayer.py +++ b/test/pytest_coreneuron/test_nlayer.py @@ -36,7 +36,7 @@ def run(self): return res -def test_nlayer(): +def _test_nlayer(): res = [] for nlayer in [1, 2, 3]: h.nlayer_extracellular(nlayer) @@ -52,10 +52,14 @@ def test_nlayer(): return res -if __name__ == "__main__": - res = test_nlayer() +def test_nlayer(): + res = _test_nlayer() for i in range(len(res[0][0])): for j in range(2): for k in range(3): print("%g" % res[k][j].x[i], end=" ") print() + + +if __name__ == "__main__": + test_nlayer()