diff --git a/testsuite/pytests/sli2py_other/test_set_tics.py b/testsuite/pytests/sli2py_other/test_set_tics.py
index 8f68627481..607968f548 100644
--- a/testsuite/pytests/sli2py_other/test_set_tics.py
+++ b/testsuite/pytests/sli2py_other/test_set_tics.py
@@ -38,32 +38,34 @@
parameters and whether the corresponding conversions are correct.
"""
-import nest
import numpy as np
import pytest
+import nest
+
@pytest.fixture(autouse=True)
def prepare():
nest.ResetKernel()
nest.set(tics_per_ms=2**14, resolution=2 ** (-4))
+ nest.set(tics_per_ms=2**14, resolution=2**-4)
def test_correct_ticks_per_ms():
actual = nest.GetKernelStatus("tics_per_ms")
- assert actual == 2 ** (14)
+ assert actual == 2**14
def test_correct_resolution():
actual = nest.GetKernelStatus("resolution")
- assert actual == 2 ** (-4)
+ assert actual == 2**-4
def test_correct_tics_per_step():
actual = nest.GetKernelStatus("tics_per_step")
- assert actual == 2 ** (10)
+ assert actual == 2**10
def test_correct_ms_per_tic():
actual = nest.GetKernelStatus("ms_per_tic")
- assert actual == 2 ** (-14)
+ assert actual == 2**-14
diff --git a/testsuite/pytests/sli2py_regressions/test_issue_410.py b/testsuite/pytests/sli2py_regressions/test_issue_410.py
new file mode 100644
index 0000000000..d4b1fa6126
--- /dev/null
+++ b/testsuite/pytests/sli2py_regressions/test_issue_410.py
@@ -0,0 +1,97 @@
+# -*- coding: utf-8 -*-
+#
+# test_issue_410.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 .
+
+"""
+Regression test for Issue #410 (GitHub).
+"""
+
+import pytest
+
+import nest
+
+pytestmark = [pytest.mark.skipif_missing_gsl, pytest.mark.skipif_missing_threads]
+
+
+def simulator(num_threads):
+ """
+ Simulate the system with provided number of threads and return weight.
+
+ Based on simulation script provided in Issue #410.
+ """
+
+ nest.ResetKernel()
+
+ nest.local_num_threads = num_threads
+
+ stim1 = nest.Create("dc_generator", {"amplitude": 1500.0})
+ stim2 = nest.Create("dc_generator", {"amplitude": 1000.0})
+ nrn1 = nest.Create("iaf_psc_alpha", {"C_m": 100.0, "tau_m": 10.0})
+ nrn2 = nest.Create("iaf_psc_alpha", {"C_m": 100.0, "tau_m": 10.0, "tau_minus": 10.0})
+ dopa = nest.Create("iaf_cond_alpha", 100, {"V_reset": -70.0, "C_m": 80.0, "V_th": -60.0})
+ vt = nest.Create("volume_transmitter")
+
+ nest.CopyModel(
+ "stdp_dopamine_synapse",
+ "syn1",
+ {
+ "Wmax": 1000.0,
+ "Wmin": 0.0,
+ "tau_plus": 10.0,
+ "A_minus": 0.05,
+ "A_plus": 0.05,
+ "b": 45.45,
+ "tau_c": 1.0,
+ "tau_n": 100.0,
+ "vt": vt.get("global_id"),
+ },
+ )
+
+ nest.Connect(stim1, nrn1, syn_spec={"weight": 10.0, "delay": 1.0})
+ nest.Connect(stim2, dopa, syn_spec={"weight": 10.0, "delay": 1.0})
+ nest.Connect(nrn1, nrn2, syn_spec={"synapse_model": "syn1", "weight": 500.0, "delay": 1.0})
+ nest.Connect(dopa, vt)
+
+ nest.Simulate(2000.0)
+
+ conns = nest.GetConnections(source=nrn1, target=nrn2)
+ weight = conns.get("weight")
+
+ return weight
+
+
+@pytest.fixture(scope="module")
+def reference_weight():
+ """
+ Fixture that simulates reference.
+ """
+
+ ref_weight = simulator(1)
+ return ref_weight
+
+
+@pytest.mark.parametrize("num_threads", [2, 4, 8, 16, 32])
+def test_multithreaded_volume_transmitter_and_stdp_dopamine_synapse(reference_weight, num_threads):
+ """
+ Test that ensures thread safety of volume transmitter.
+ """
+
+ weight = simulator(num_threads)
+ assert weight == reference_weight
diff --git a/testsuite/regressiontests/issue-410.sli b/testsuite/regressiontests/issue-410.sli
deleted file mode 100644
index 1d199ba16c..0000000000
--- a/testsuite/regressiontests/issue-410.sli
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * issue-410.sli
- *
- * 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 .
- *
- */
-
-
-/** @BeginDocumentation
- Name: testsuite::issue-410 - Ensure thread safety of volume transmitter
-
- Synopsis: (issue-410) run -> NEST exits if test fails
- Description:
- This test compares the impact of the volume transmitter
- on a dopamine synapse using different number of threads.
-
- FirstVersion: 07/2016
- Author: Till Schumann
- */
-
-(unittest) run
-/unittest using
-
-% The following test needs the model iaf_cond_alpha, so
-% this test should only run if we have GSL
-skip_if_without_gsl
-
-M_ERROR setverbosity
-
-skip_if_not_threaded
-
-/sim_weight_in_dopa_syn
-{
- /threads Set
-
- ResetKernel
- << /local_num_threads threads >> SetKernelStatus
-
- /dc_generator << /amplitude 1500.0 >> Create /stim1 Set
- /dc_generator << /amplitude 1000.0 >> Create /stim2 Set
-
- /iaf_psc_alpha << /C_m 100.0 /tau_m 10.0 >> Create /neuron1 Set
- /iaf_psc_alpha << /C_m 100.0 /tau_m 10.0 /tau_minus 10.0 >> Create /neuron2 Set
- /iaf_cond_alpha 100 << /V_reset -70.0 /C_m 80.0 /V_th -60.0 >> Create /dopa Set
-
- /volume_transmitter Create /vt Set
-
- /stdp_dopamine_synapse /syn1
- << /Wmax 1000.0
- /Wmin 0.0
- /tau_plus 10.0
- /A_minus 0.05
- /A_plus 0.05
- /b 45.45
- /tau_c 1.0
- /tau_n 100.0
- /vt vt 0 get >> CopyModel
-
- stim1 neuron1 10.0 1.0 Connect
- stim2 dopa 10.0 1.0 Connect
- neuron1 neuron2 500.0 1.0 /syn1 Connect
- dopa vt Connect
-
- 2000.0 Simulate
-
- %push return value
- << /source neuron1 /target neuron2 >> GetConnections /conns Set
- conns size 0 gt {
- 0 get GetStatus /weight get
- }{
- 0.0
- } ifelse
-} def
-
-{
- 1 sim_weight_in_dopa_syn /t1 Set
- 2 sim_weight_in_dopa_syn /t2 Set
- 4 sim_weight_in_dopa_syn /t3 Set
- 8 sim_weight_in_dopa_syn /t4 Set
- 16 sim_weight_in_dopa_syn /t5 Set
- 32 sim_weight_in_dopa_syn /t6 Set
-
- (1 thread weight=) t1 cvs join =
- (2 threads weight=) t2 cvs join =
- (4 threads weight=) t3 cvs join =
- (8 threads weight=) t4 cvs join =
- (16 threads weight=) t5 cvs join =
- (32 threads weight=) t6 cvs join =
-
- t1 6 ToUnitTestPrecision t2 6 ToUnitTestPrecision eq
- t1 6 ToUnitTestPrecision t3 6 ToUnitTestPrecision eq and
- t1 6 ToUnitTestPrecision t4 6 ToUnitTestPrecision eq and
- t1 6 ToUnitTestPrecision t5 6 ToUnitTestPrecision eq and
- t1 6 ToUnitTestPrecision t6 6 ToUnitTestPrecision eq and
-} assert_or_die
-
-endusing