From 791a9a0521f790b215b221d841deaf35695d0660 Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Thu, 30 Sep 2021 12:48:11 -0400 Subject: [PATCH 1/2] When running nosetests, raise exceptions for arithmetic errors. nosetests will invoke the functions setup_module() and teardown_module(), if defined, before and after running all test cases within the module. In general, numpy arithmetic errors (e.g. integer or floating-point overflow, or division by zero) should not happen under normal circumstances, and the package should neither assume that these errors will raise an exception, nor assume that they won't. Therefore, while running the test suite, set the numpy error handling mode to "raise" so the test will fail if such an error occurs. --- tests/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..65ad25c1 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,16 @@ +import numpy as np + + +_np_error_state = {} + + +def setup_module(): + # Raise exceptions for arithmetic errors, except underflow + global _np_error_state + _np_error_state = np.seterr() + np.seterr('raise', under='ignore') + + +def teardown_module(): + # Restore original error handling state + np.seterr(**_np_error_state) From eed0bb94b4590b2c385e4211e446d28fbd2e28e2 Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Thu, 30 Sep 2021 14:00:16 -0400 Subject: [PATCH 2/2] .github/workflows: Run tests on Debian buster i386. In addition to running the test suite on the "latest" OS images provided by GitHub, with the latest dependencies installed from pip, also run the test suite on 32-bit Debian 10 (via Docker), with stable dependencies installed from Debian. This should help to catch incompatibilities with older package versions, as well as errors due to differing CPU architectures. --- .github/workflows/run-tests.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index cbca50a1..0409c388 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -32,3 +32,29 @@ jobs: - name: Run nosetests run: | nosetests + + test-deb10-i386: + runs-on: ubuntu-latest + container: i386/debian:10 + steps: + - name: Install dependencies + run: | + apt-get update + apt-get install -y --no-install-recommends \ + python3-matplotlib \ + python3-numpy \ + python3-pandas \ + python3-requests \ + python3-scipy \ + python3-nose \ + git + + # Note: "actions/checkout@v2" requires libstdc++6:amd64 to be + # installed in the container. To keep things simple, use + # "actions/checkout@v1" instead. + # https://github.com/actions/checkout/issues/334 + - uses: actions/checkout@v1 + + - name: Run nosetests + run: | + nosetests3