diff --git a/mcmc_examples/arma/arma.py b/mcmc_examples/arma/arma.py index 2614564..3817bce 100644 --- a/mcmc_examples/arma/arma.py +++ b/mcmc_examples/arma/arma.py @@ -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]) diff --git a/mcmc_examples/lighthouse/lighthouse.py b/mcmc_examples/lighthouse/lighthouse.py index 233ea2d..314852b 100644 --- a/mcmc_examples/lighthouse/lighthouse.py +++ b/mcmc_examples/lighthouse/lighthouse.py @@ -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]) diff --git a/mcmc_integration_tests/README.md b/mcmc_integration_tests/README.md new file mode 100644 index 0000000..3b8270a --- /dev/null +++ b/mcmc_integration_tests/README.md @@ -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. diff --git a/mcmc_integration_tests/__init__.py b/mcmc_integration_tests/__init__.py new file mode 100644 index 0000000..bcb376d --- /dev/null +++ b/mcmc_integration_tests/__init__.py @@ -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 . diff --git a/mcmc_integration_tests/script_builder.py b/mcmc_integration_tests/script_builder.py new file mode 100644 index 0000000..5e9af45 --- /dev/null +++ b/mcmc_integration_tests/script_builder.py @@ -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 . + +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() diff --git a/mcmc_integration_tests/test_scripts.py b/mcmc_integration_tests/test_scripts.py new file mode 100644 index 0000000..9d41980 --- /dev/null +++ b/mcmc_integration_tests/test_scripts.py @@ -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 . + +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")