diff --git a/.travis.yml b/.travis.yml index 2a1add03..ab62bc26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,8 @@ install: script: - pip uninstall spotpy -y - - py.test spotpy/tests/test_* --cov spotpy --cov-report term-missing -v - - mpirun -c 2 python spotpy/examples/dds/dds_parallel.py 10 + - py.test tests/test_* --cov spotpy --cov-report term-missing -v + - mpirun -c 4 python spotpy/examples/dds/dds_parallel.py 100 after_success: - coveralls diff --git a/setup.py b/setup.py index c8d9a6e4..91d5694c 100644 --- a/setup.py +++ b/setup.py @@ -28,9 +28,9 @@ 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Software Development :: Libraries :: Python Modules'], ) diff --git a/spotpy/examples/hymod_python/hymod.py b/spotpy/examples/hymod_python/hymod.py index bb0a7ac5..ae10739b 100644 --- a/spotpy/examples/hymod_python/hymod.py +++ b/spotpy/examples/hymod_python/hymod.py @@ -1,6 +1,6 @@ from numba import jit -@jit + def hymod(Precip, PET, cmax,bexp,alpha,Rs,Rq): """ See https://www.proc-iahs.net/368/180/2015/piahs-368-180-2015.pdf for a scientific paper. @@ -22,7 +22,6 @@ def hymod(Precip, PET, cmax,bexp,alpha,Rs,Rq): # Initialize state(s) of quick tank(s) x_quick = [0,0,0] t = 0 - outflow = [] output = [] # START PROGRAMMING LOOP WITH DETERMINING RAINFALL - RUNOFF AMOUNTS @@ -50,7 +49,6 @@ def hymod(Precip, PET, cmax,bexp,alpha,Rs,Rq): output.append(QS + outflow) t = t+1 - return output @jit diff --git a/spotpy/tests/__init__.py b/tests/__init__.py similarity index 100% rename from spotpy/tests/__init__.py rename to tests/__init__.py diff --git a/spotpy/tests/dds_tests/normal_list.txt b/tests/dds_tests/normal_list.txt similarity index 100% rename from spotpy/tests/dds_tests/normal_list.txt rename to tests/dds_tests/normal_list.txt diff --git a/spotpy/tests/dds_tests/run_1.json b/tests/dds_tests/run_1.json similarity index 100% rename from spotpy/tests/dds_tests/run_1.json rename to tests/dds_tests/run_1.json diff --git a/spotpy/tests/dds_tests/run_2.json b/tests/dds_tests/run_2.json similarity index 100% rename from spotpy/tests/dds_tests/run_2.json rename to tests/dds_tests/run_2.json diff --git a/spotpy/tests/dds_tests/run_3.json b/tests/dds_tests/run_3.json similarity index 100% rename from spotpy/tests/dds_tests/run_3.json rename to tests/dds_tests/run_3.json diff --git a/spotpy/tests/dds_tests/run_4.json b/tests/dds_tests/run_4.json similarity index 100% rename from spotpy/tests/dds_tests/run_4.json rename to tests/dds_tests/run_4.json diff --git a/spotpy/tests/dds_tests/run_5.json b/tests/dds_tests/run_5.json similarity index 100% rename from spotpy/tests/dds_tests/run_5.json rename to tests/dds_tests/run_5.json diff --git a/spotpy/tests/dds_tests/run_6.json b/tests/dds_tests/run_6.json similarity index 100% rename from spotpy/tests/dds_tests/run_6.json rename to tests/dds_tests/run_6.json diff --git a/spotpy/tests/dds_tests/run_7.json b/tests/dds_tests/run_7.json similarity index 100% rename from spotpy/tests/dds_tests/run_7.json rename to tests/dds_tests/run_7.json diff --git a/spotpy/tests/dds_tests/run_own_input_1.json b/tests/dds_tests/run_own_input_1.json similarity index 100% rename from spotpy/tests/dds_tests/run_own_input_1.json rename to tests/dds_tests/run_own_input_1.json diff --git a/spotpy/tests/dds_tests/run_own_input_2.json b/tests/dds_tests/run_own_input_2.json similarity index 100% rename from spotpy/tests/dds_tests/run_own_input_2.json rename to tests/dds_tests/run_own_input_2.json diff --git a/spotpy/tests/dds_tests/uniform_list.txt b/tests/dds_tests/uniform_list.txt similarity index 100% rename from spotpy/tests/dds_tests/uniform_list.txt rename to tests/dds_tests/uniform_list.txt diff --git a/spotpy/tests/mpitest.sh b/tests/mpitest.sh similarity index 100% rename from spotpy/tests/mpitest.sh rename to tests/mpitest.sh diff --git a/spotpy/tests/padds_tests/CHC_testdata.json b/tests/padds_tests/CHC_testdata.json similarity index 100% rename from spotpy/tests/padds_tests/CHC_testdata.json rename to tests/padds_tests/CHC_testdata.json diff --git a/spotpy/tests/padds_tests/HVC_testdata.json b/tests/padds_tests/HVC_testdata.json similarity index 100% rename from spotpy/tests/padds_tests/HVC_testdata.json rename to tests/padds_tests/HVC_testdata.json diff --git a/spotpy/tests/padds_tests/run_1.json b/tests/padds_tests/run_1.json similarity index 100% rename from spotpy/tests/padds_tests/run_1.json rename to tests/padds_tests/run_1.json diff --git a/spotpy/tests/padds_tests/run_2.json b/tests/padds_tests/run_2.json similarity index 100% rename from spotpy/tests/padds_tests/run_2.json rename to tests/padds_tests/run_2.json diff --git a/spotpy/tests/padds_tests/run_3.json b/tests/padds_tests/run_3.json similarity index 100% rename from spotpy/tests/padds_tests/run_3.json rename to tests/padds_tests/run_3.json diff --git a/spotpy/tests/padds_tests/run_4.json b/tests/padds_tests/run_4.json similarity index 100% rename from spotpy/tests/padds_tests/run_4.json rename to tests/padds_tests/run_4.json diff --git a/spotpy/tests/padds_tests/run_5.json b/tests/padds_tests/run_5.json similarity index 100% rename from spotpy/tests/padds_tests/run_5.json rename to tests/padds_tests/run_5.json diff --git a/spotpy/tests/padds_tests/run_6.json b/tests/padds_tests/run_6.json similarity index 100% rename from spotpy/tests/padds_tests/run_6.json rename to tests/padds_tests/run_6.json diff --git a/spotpy/tests/padds_tests/run_7.json b/tests/padds_tests/run_7.json similarity index 100% rename from spotpy/tests/padds_tests/run_7.json rename to tests/padds_tests/run_7.json diff --git a/spotpy/tests/padds_tests/run_8.json b/tests/padds_tests/run_8.json similarity index 100% rename from spotpy/tests/padds_tests/run_8.json rename to tests/padds_tests/run_8.json diff --git a/spotpy/tests/padds_tests/run_9.json b/tests/padds_tests/run_9.json similarity index 100% rename from spotpy/tests/padds_tests/run_9.json rename to tests/padds_tests/run_9.json diff --git a/spotpy/tests/test_algorithms.py b/tests/test_algorithms.py similarity index 100% rename from spotpy/tests/test_algorithms.py rename to tests/test_algorithms.py diff --git a/spotpy/tests/test_analyser.py b/tests/test_analyser.py similarity index 100% rename from spotpy/tests/test_analyser.py rename to tests/test_analyser.py diff --git a/spotpy/tests/test_cli.py b/tests/test_cli.py similarity index 100% rename from spotpy/tests/test_cli.py rename to tests/test_cli.py diff --git a/spotpy/tests/test_database.py b/tests/test_database.py similarity index 100% rename from spotpy/tests/test_database.py rename to tests/test_database.py diff --git a/spotpy/tests/test_dds.py b/tests/test_dds.py similarity index 100% rename from spotpy/tests/test_dds.py rename to tests/test_dds.py diff --git a/spotpy/tests/test_describe.py b/tests/test_describe.py similarity index 100% rename from spotpy/tests/test_describe.py rename to tests/test_describe.py diff --git a/spotpy/tests/test_fast.py b/tests/test_fast.py similarity index 99% rename from spotpy/tests/test_fast.py rename to tests/test_fast.py index 7c9b9df9..33aa7734 100644 --- a/spotpy/tests/test_fast.py +++ b/tests/test_fast.py @@ -14,7 +14,6 @@ sys.path.append(".") import spotpy - from spotpy.examples.spot_setup_hymod_python import spot_setup # Test only untder Python 3 as lower versions results in a strange fft error diff --git a/spotpy/tests/test_gui_mpl.py b/tests/test_gui_mpl.py similarity index 100% rename from spotpy/tests/test_gui_mpl.py rename to tests/test_gui_mpl.py diff --git a/spotpy/tests/test_likelihood.py b/tests/test_likelihood.py similarity index 100% rename from spotpy/tests/test_likelihood.py rename to tests/test_likelihood.py diff --git a/spotpy/tests/test_list_and_constant_parameters_with_samplers.py b/tests/test_list_and_constant_parameters_with_samplers.py similarity index 100% rename from spotpy/tests/test_list_and_constant_parameters_with_samplers.py rename to tests/test_list_and_constant_parameters_with_samplers.py diff --git a/spotpy/tests/test_objectivefunctions.py b/tests/test_objectivefunctions.py similarity index 100% rename from spotpy/tests/test_objectivefunctions.py rename to tests/test_objectivefunctions.py diff --git a/spotpy/tests/test_padds.py b/tests/test_padds.py similarity index 98% rename from spotpy/tests/test_padds.py rename to tests/test_padds.py index e5dff87a..846b4d77 100644 --- a/spotpy/tests/test_padds.py +++ b/tests/test_padds.py @@ -9,7 +9,7 @@ import numpy as np from spotpy.examples.tutorial_padds import padds_spot_setup -from spotpy.tests.test_dds import FixedRandomizer +from tests.test_dds import FixedRandomizer try: import spotpy diff --git a/spotpy/tests/test_parallel.py b/tests/test_parallel.py similarity index 98% rename from spotpy/tests/test_parallel.py rename to tests/test_parallel.py index f9dbaad9..58868643 100644 --- a/spotpy/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -18,7 +18,7 @@ def setUpClass(self): # How many digits to match in case of floating point answers self.tolerance = 7 #Create samplers for every algorithm: - self.rep = 987 + self.rep = 21 self.timeout = 10 #Given in Seconds self.dbformat = "ram" diff --git a/spotpy/tests/test_parameter.py b/tests/test_parameter.py similarity index 100% rename from spotpy/tests/test_parameter.py rename to tests/test_parameter.py diff --git a/spotpy/tests/test_setup_parameters.py b/tests/test_setup_parameters.py similarity index 93% rename from spotpy/tests/test_setup_parameters.py rename to tests/test_setup_parameters.py index 78d48aa0..0f89ce4f 100644 --- a/spotpy/tests/test_setup_parameters.py +++ b/tests/test_setup_parameters.py @@ -110,7 +110,7 @@ def test_create(self): def test_assign(self): values = [1] * len(self.ps) self.ps(*values) - self.assertEquals(list(self.ps), values) + self.assertEqual(list(self.ps), values) # Test if wrong number of parameters raises with self.assertRaises(ValueError): self.ps(*values[:-1]) @@ -119,13 +119,13 @@ def test_iter(self): values = [1] * len(self.ps) self.ps(*values) ps_values = list(self.ps) - self.assertEquals(values, ps_values) + self.assertEqual(values, ps_values) def test_getitem(self): values = [1] * len(self.ps) self.ps(*values) - self.assertEquals(self.ps['a'], 1.0) - self.assertEquals(self.ps[0], 1.0) + self.assertEqual(self.ps['a'], 1.0) + self.assertEqual(self.ps[0], 1.0) def test_getattr(self): values = [1] * len(self.ps) @@ -134,15 +134,15 @@ def test_getattr(self): with self.assertRaises(AttributeError): _ = self.ps.__x - self.assertEquals(self.ps.a, 1.0) - self.assertEquals(list(self.ps.random), list(self.ps), 'Access to random variable does not equal list of names') + self.assertEqual(self.ps.a, 1.0) + self.assertEqual(list(self.ps.random), list(self.ps), 'Access to random variable does not equal list of names') with self.assertRaises(AttributeError): _ = self.ps.x def test_setattr(self): self.ps.a = 2 - self.assertEquals(self.ps[0], 2) + self.assertEqual(self.ps[0], 2) def test_dir(self): values = [1] * len(self.ps) @@ -157,12 +157,12 @@ def test_dir(self): def test_str(self): values = [1] * len(self.ps) self.ps(*values) - self.assertEquals(str(self.ps), 'parameters(a=1, b=1, c=1, d=1)') + self.assertEqual(str(self.ps), 'parameters(a=1, b=1, c=1, d=1)') def test_repr(self): values = [1] * len(self.ps) self.ps(*values) - self.assertEquals(repr(self.ps), 'spotpy.parameter.ParameterSet()') + self.assertEqual(repr(self.ps), 'spotpy.parameter.ParameterSet()') class TestSetupVariants(unittest.TestCase): diff --git a/spotpy/tests/test_signatures.py b/tests/test_signatures.py similarity index 99% rename from spotpy/tests/test_signatures.py rename to tests/test_signatures.py index 8c825b20..802c2638 100644 --- a/spotpy/tests/test_signatures.py +++ b/tests/test_signatures.py @@ -14,8 +14,6 @@ import spotpy from spotpy.hydrology.signatures import SignatureMethod - - import spotpy.hydrology as sig class TestSignatures(unittest.TestCase): diff --git a/spotpy/tests/testutils.py b/tests/testutils.py similarity index 100% rename from spotpy/tests/testutils.py rename to tests/testutils.py