forked from nest/nest-simulator
/
test_all.py
75 lines (66 loc) · 2.28 KB
/
test_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- coding: utf-8 -*-
#
# test_all.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# NEST is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.
import unittest
import nest
from . import test_synaptic_elements
from . import test_conn_builder
from . import test_growth_curves
from . import test_sp_manager
from . import test_disconnect
from . import test_disconnect_multiple
from . import test_enable_multithread
from . import test_get_sp_status
HAVE_MPI = nest.sli_func("statusdict/have_mpi ::")
if HAVE_MPI:
print ("Testing with MPI")
from subprocess import call
import sys
import os
__author__ = 'naveau'
def suite():
# MPI tests
if HAVE_MPI:
try:
# Get the MPI command
command = nest.sli_func(
"mpirun", 2, "python", "test_sp/mpitest_issue_578_sp.py")
print ("Executing test with command: " + command)
command = command.split()
call(command)
except:
print (sys.exc_info()[0])
print ("Test call with MPI ended in error")
raise
test_suite = unittest.TestSuite()
test_suite.addTest(test_synaptic_elements.suite())
test_suite.addTest(test_conn_builder.suite())
test_suite.addTest(test_growth_curves.suite())
test_suite.addTest(test_sp_manager.suite())
test_suite.addTest(test_synaptic_elements.suite())
test_suite.addTest(test_disconnect.suite())
test_suite.addTest(test_disconnect_multiple.suite())
test_suite.addTest(test_enable_multithread.suite())
test_suite.addTest(test_get_sp_status.suite())
return test_suite
if __name__ == "__main__":
nest.set_verbosity('M_WARNING')
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite())