Repository: passaH2O/dorado (language: python)

Issue:
Build failing on Ubuntu (Python 3.8+)
The last two build attempts have failed for `ubuntu-latest 3.8` and `3.9` (all other tests are passing). Specifically, we're getting an assertion error for three of the tests in `tests/test_examplecases.py::TestRCM`. Here's the failure message:
```
=========================== short test summary info ============================
FAILED tests/test_examplecases.py::TestRCM::test_few_steps_RCM - assert [0, 700759344...472986.069204] == [0, 700759344...473384.876724]
  At index 1 diff: 7007593448.337233 != 7007593448.337235
  Full diff:
  - [0, 7007593448.337235, 10439964733.462337, 13698473384.876724]
  ?                     ^           ^^^^ ^^^^         ^^ ^ ^^ ^
  + [0, 7007593448.337233, 10439964528.877066, 13698472986.069204]
  ?                     ^          +++++ ^^ ^         ^^ ^ ^ ^ +
FAILED tests/test_examplecases.py::TestRCM::test_set_time_RCM_previousdata - assert [0, 7007593448.337233] == [0, 7007593448.337235]
  At index 1 diff: 7007593448.337233 != 7007593448.337235
  Full diff:
  - [0, 7007593448.337235]
  ?                     ^
  + [0, 7007593448.337233]
  ?                     ^
FAILED tests/test_examplecases.py::TestRCM::test_set_time_RCM - assert [0, 7007593448.337233] == [0, 7007593448.337235]
  At index 1 diff: 7007593448.337233 != 7007593448.337235
  Full diff:
  - [0, 7007593448.337235]
  ?                     ^
  + [0, 7007593448.337233]
  ?                     ^
========================= 3 failed, 88 passed in 4.55s =========================
```

It looks to me like our random seed isn't guaranteeing identical travel times in newer versions of Python, because the error is occurring quite far down the list of sig-figs. The difference is on the order of 10^-8. I'm thinking an acceptable fix would be to change the assertion to check whether the results are within some threshold difference of each other, maybe 10^-6? Let me know if that works for you @elbeejay , happy to work on this later.


Discussion / hints:
That sounds good to me @wrightky - maybe using `pytest.approx` would be most appropriate with some relative tolerance of a hundredth or something?

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d159179..79da2ea 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -15,7 +15,7 @@ jobs:
       fail-fast: false
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        python-version: [3.7, 3.8, 3.9]
+        python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
     env:
       OS: ${{ matrix.os }}
       PYTHON: ${{ matrix.python-version }}
@@ -45,41 +45,13 @@ jobs:
         name: codecov-umbrella
         fail_ci_if_error: false
 
-  legacy:
-    runs-on: ${{ matrix.os }}
-    strategy:
-      fail-fast: false
-      matrix:
-        os: [ubuntu-20.04, windows-2019]
-        python-version: [2.7]
-    env:
-      OS: ${{ matrix.os }}
-      PYTHON: ${{ matrix.python-version }}
-    steps:
-    - uses: actions/checkout@v2
-    - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
-      with:
-        python-version: ${{ matrix.python-version }}
-    - name: Install dependencies
-      run: |
-        python -m pip install --upgrade pip
-        pip install pytest pytest-cov coveralls
-        pip install -r requirements.txt
-    - name: Install dorado
-      run: |
-        pip install -e .
-    - name: Test with pytest
-      run: |
-        pytest --cov=dorado/ --cov-report=xml
-
   examples:
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
       matrix:
         os: [ubuntu-latest]
-        python-version: [3.7]
+        python-version: ["3.9"]
     env:
       OS: ${{ matrix.os }}
       PYTHON: ${{ matrix.python-version }}
diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml
index 3d83542..ef64a32 100644
--- a/conda/conda_build_config.yaml
+++ b/conda/conda_build_config.yaml
@@ -3,3 +3,6 @@ python:
   - 3.6
   - 3.7
   - 3.8
+  - 3.9
+  - 3.10
+  - 3.11
diff --git a/dorado/__init__.py b/dorado/__init__.py
index c26816d..b5a99ac 100644
--- a/dorado/__init__.py
+++ b/dorado/__init__.py
@@ -1,4 +1,4 @@
-__version__ = "2.5.2"
+__version__ = "2.5.3"
 
 from . import lagrangian_walker
 from . import parallel_routing
diff --git a/setup.py b/setup.py
index c76666a..88c11b5 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
 
 setup(
     name = 'pydorado',
-    version = '2.5.2',
+    version = '2.5.3',
     license = 'MIT',
     description = 'dorado - Lagrangian particle routing routine via weighted random walks',
     author = 'J. Hariharan, K. Wright, P. Passalacqua',
@@ -12,10 +12,13 @@
     packages = find_packages(exclude=['*.tests']),
     package_data = {'' : ['*.txt', '*.npz']},
     long_description = 'See project webpage for details: https://github.com/passaH2O/dorado',
-    classifiers = ['Programming Language :: Python :: 2.7',
-                   'Programming Language :: Python :: 3.7',
-                   'Programming Language :: Python :: 3.8',
-		   'Programming Language :: Python :: 3.9'],
+    classifiers = [
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+		'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10'
+        'Programming Language :: Python :: 3.11'],
     install_requires = ['numpy','matplotlib','scipy',
                         'future','tqdm'],
 )


Test patch:
diff --git a/tests/test_examplecases.py b/tests/test_examplecases.py
index a66f257..eb48b98 100644
--- a/tests/test_examplecases.py
+++ b/tests/test_examplecases.py
@@ -51,8 +51,9 @@ def test_few_steps_RCM(self):
         # check all positions and times
         assert all_walk_data['xinds'][0] == [16, 17, 18, 19]
         assert all_walk_data['yinds'][0] == [140, 141, 141, 141]
-        assert all_walk_data['travel_times'][0] == \
-            [0, 7007593448.337235, 10439964733.462337, 13698473384.876724]
+        assert all_walk_data['travel_times'][0] == pytest.approx(
+            [0, 7007593448.337235, 10439964733.462337, 13698473384.876724],
+            rel=1e-6)
 
     def test_set_time_RCM_previousdata(self):
         '''
@@ -76,7 +77,8 @@ def test_set_time_RCM_previousdata(self):
         # check all positions and times
         assert all_walk_data['xinds'][0] == [16, 17]
         assert all_walk_data['yinds'][0] == [140, 141]
-        assert all_walk_data['travel_times'][0] == [0, 7007593448.337235]
+        assert all_walk_data['travel_times'][0] == pytest.approx(
+            [0, 7007593448.337235], rel=1e-6)
 
     def test_set_time_RCM(self):
         '''
@@ -101,7 +103,8 @@ def test_set_time_RCM(self):
         # check all positions and times
         assert all_walk_data['xinds'][0] == [16, 17]
         assert all_walk_data['yinds'][0] == [140, 141]
-        assert all_walk_data['travel_times'][0] == [0, 7007593448.337235]
+        assert all_walk_data['travel_times'][0] == pytest.approx(
+            [0, 7007593448.337235], rel=1e-6)
 
 
 class TestANUGA: