Skip to content

Commit

Permalink
Fix PytestReturnNotNoneWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
JCGoran committed Oct 3, 2024
1 parent 5b49b24 commit 8276554
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
10 changes: 7 additions & 3 deletions test/coreneuron/test_netmove.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -111,14 +111,18 @@ 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:
print(result[0], result[1])
result[2].line(g)
g.exec_menu("View = plot")
h.quit()


if __name__ == "__main__":
test_netmove()
12 changes: 8 additions & 4 deletions test/coreneuron/test_spikes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
10 changes: 7 additions & 3 deletions test/gjtests/test_natrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
10 changes: 7 additions & 3 deletions test/pytest_coreneuron/test_nlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

0 comments on commit 8276554

Please sign in to comment.