-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #761 from apdavison/pytest
Migrate test suite from nose to pytest
- Loading branch information
Showing
46 changed files
with
769 additions
and
858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +0,0 @@ | ||
# encoding: utf-8 | ||
from testconfig import config | ||
|
||
|
||
if 'testFile' in config: | ||
file_name = config['testFile'] | ||
exec("from . import ( %s )" % file_name) | ||
else: | ||
from . import (scenario1, | ||
scenario2, | ||
scenario3, | ||
ticket166, | ||
test_simulation_control, | ||
test_recording, | ||
test_cell_types, | ||
test_electrodes, | ||
scenario4, | ||
test_parameter_handling, | ||
test_procedural_api, | ||
issue274, | ||
test_connectors, | ||
issue231, | ||
test_connection_handling, | ||
test_synapse_types) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import functools | ||
import pytest | ||
|
||
available_modules = {} | ||
|
||
try: | ||
import pyNN.neuron | ||
available_modules["neuron"] = pyNN.neuron | ||
except ImportError: | ||
pass | ||
|
||
try: | ||
import pyNN.nest | ||
available_modules["nest"] = pyNN.nest | ||
except ImportError: | ||
pass | ||
|
||
try: | ||
import pyNN.brian2 | ||
available_modules["brian2"] = pyNN.brian2 | ||
except ImportError: | ||
pass | ||
|
||
|
||
class SimulatorNotAvailable: | ||
|
||
def __init__(self, sim_name): | ||
self.sim_name = sim_name | ||
|
||
def setup(self, *args, **kwargs): | ||
pytest.skip(f"{self.sim_name} not available") | ||
|
||
|
||
def get_simulator(sim_name): | ||
if sim_name in available_modules: | ||
return pytest.param(available_modules[sim_name], id=sim_name) | ||
else: | ||
return pytest.param(SimulatorNotAvailable(sim_name), id=sim_name) | ||
|
||
|
||
def run_with_simulators(*sim_names): | ||
sim_modules = (get_simulator(sim_name) for sim_name in sim_names) | ||
|
||
return pytest.mark.parametrize("sim", sim_modules) |
Oops, something went wrong.