Skip to content

Commit

Permalink
merged in master
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Apr 9, 2021
2 parents 9333697 + 075e346 commit de2aa31
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mcmc_examples/arma/arma.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@

# get n_samples and n_boards from command line arguments if specified
if (len(sys.argv) == 2):
n_samples = int(sys.argv[1])
if sys.argv[1] != 'test_scripts.py':
n_samples = int(sys.argv[1])
elif (len(sys.argv) == 3):
n_samples = int(sys.argv[1])
n_boards = int(sys.argv[2])
Expand Down
3 changes: 2 additions & 1 deletion mcmc_examples/lighthouse/lighthouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@

# get n_samples and n_boards from command line arguments if specified
if (len(sys.argv) == 2):
n_samples = int(sys.argv[1])
if sys.argv[1] != 'test_scripts.py':
n_samples = int(sys.argv[1])
elif (len(sys.argv) == 3):
n_samples = int(sys.argv[1])
n_boards = int(sys.argv[2])
Expand Down
5 changes: 5 additions & 0 deletions mcmc_integration_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
These tests depend on https://github.com/SpiNNakerManchester/TestBase

This is not added automatically by setup.py

Running mcmc_integration_tests/script_builder.py will recreate test_scipts.py adding any new files added to existing directories.
14 changes: 14 additions & 0 deletions mcmc_integration_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2016-2021 The University of Manchester
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
40 changes: 40 additions & 0 deletions mcmc_integration_tests/script_builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2017-2019 The University of Manchester
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.

from spinnaker_testbase import RootScriptBuilder


class ScriptBuilder(RootScriptBuilder):
"""
This file will recreate the test_scripts.py file
"""

def build_mcmc_scripts(self):
# create_test_scripts supports test that are too long or exceptions
# These scripts raise a SkipTest with the reasons given
exceptions = {}
NOT_SCRIPT = "Not a run script"
exceptions["arma_fixed_point_model.py"] = NOT_SCRIPT
exceptions["arma_float_model.py"] = NOT_SCRIPT
exceptions["arma_model.py"] = NOT_SCRIPT
exceptions["lighthouse_fixed_point_model.py"] = NOT_SCRIPT
exceptions["lighthouse_float_model.py"] = NOT_SCRIPT
exceptions["lighthouse_model.py"] = NOT_SCRIPT
self.create_test_scripts(["mcmc_examples/"], exceptions=exceptions)


if __name__ == '__main__':
builder = ScriptBuilder()
builder.build_mcmc_scripts()
60 changes: 60 additions & 0 deletions mcmc_integration_tests/test_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright (c) 2019-2021 The University of Manchester
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.

from spinnaker_testbase import ScriptChecker
from unittest import SkipTest # pylint: disable=unused-import


class TestScripts(ScriptChecker):
"""
This file tests the scripts as configured in script_builder.py
Please do not manually edit this file.
It is rebuilt each time SpiNNakerManchester/IntegrationTests is run
If it is out of date please edit and run script_builder.py
Then the new file can be added to github for reference only.
"""
# flake8: noqa

def test_mcmc_examples_lighthouse_lighthouse_float_model(self):
raise SkipTest("Not a run script")
self.check_script("mcmc_examples/lighthouse/lighthouse_float_model.py")

def test_mcmc_examples_lighthouse_lighthouse(self):
self.check_script("mcmc_examples/lighthouse/lighthouse.py")

def test_mcmc_examples_lighthouse_lighthouse_fixed_point_model(self):
raise SkipTest("Not a run script")
self.check_script("mcmc_examples/lighthouse/lighthouse_fixed_point_model.py")

def test_mcmc_examples_lighthouse_lighthouse_model(self):
raise SkipTest("Not a run script")
self.check_script("mcmc_examples/lighthouse/lighthouse_model.py")

def test_mcmc_examples_arma_arma(self):
self.check_script("mcmc_examples/arma/arma.py")

def test_mcmc_examples_arma_arma_float_model(self):
raise SkipTest("Not a run script")
self.check_script("mcmc_examples/arma/arma_float_model.py")

def test_mcmc_examples_arma_arma_fixed_point_model(self):
raise SkipTest("Not a run script")
self.check_script("mcmc_examples/arma/arma_fixed_point_model.py")

def test_mcmc_examples_arma_arma_model(self):
raise SkipTest("Not a run script")
self.check_script("mcmc_examples/arma/arma_model.py")

0 comments on commit de2aa31

Please sign in to comment.