From 3c4c3fcc985ead74e1a32c65a43781caf0b5c60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Sch=C3=B6lzel?= Date: Mon, 30 Sep 2024 21:08:43 +0200 Subject: [PATCH 1/5] expands matrix to also test with extras --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 429bb80..50c8bdb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,14 +9,15 @@ jobs: strategy: matrix: python: ["3.7", "3.10"] + extras: ["", "[RANSAC, qrandom, plots]"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - - run: pip install . + - run: pip install ".${{ matrix.extras }}" - run: pip install codecov . - run: coverage run -m unittest nolds.test_measures - run: codecov - if: ${{ matrix.python == '3.10' }} + if: ${{ matrix.python == '3.10' && matrix.extras != '' }} From 109701b9ecf27a21d182d82a40ed92c55e467dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Sch=C3=B6lzel?= Date: Mon, 30 Sep 2024 21:13:39 +0200 Subject: [PATCH 2/5] skips RANSAC tests if scipy isn't available --- nolds/test_measures.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nolds/test_measures.py b/nolds/test_measures.py index 2777dde..914e785 100644 --- a/nolds/test_measures.py +++ b/nolds/test_measures.py @@ -563,6 +563,7 @@ def test_corr_dim(self): cd = nolds.corr_dim(data, emb_dim=5, lag=1, rvals=None, dist=nolds.rowwise_euclidean, fit="poly") self.assertAlmostEqual(1.303252839255068, cd, places=15) + @unittest.skipUnless(SCIPY_AVAILABLE, "Tests with RANSAC require scipy.") def test_corr_dim_RANSAC(self): """Test hypothesis: The exact output of corr_dim() with `fit=RANSAC` on random data hasn't changed since the last version.""" data = datasets.load_qrandom()[:1000] @@ -589,6 +590,7 @@ def test_lyap_r(self): expected = 0.094715945307378 self.assertAlmostEqual(expected, le, places=15) + @unittest.skipUnless(SCIPY_AVAILABLE, "Tests with RANSAC require scipy.") def test_lyap_r_RANSAC(self): """Test hypothesis: The exact output of lyap_r() with `fit=RANSAC` on random data hasn't changed since the last version.""" data = datasets.load_qrandom()[:1000] @@ -606,6 +608,7 @@ def test_hurst_rs(self): expected = 0.5123887964986258 self.assertAlmostEqual(expected, rs, places=15) + @unittest.skipUnless(SCIPY_AVAILABLE, "Tests with RANSAC require scipy.") def test_hurst_rs_RANSAC(self): """Test hypothesis: The exact output of hurst_rs() with `fit=RANSAC` on random data hasn't changed since the last version.""" data = datasets.load_qrandom()[:1000] @@ -623,6 +626,7 @@ def test_dfa(self): expected = 0.5450874638765073 self.assertAlmostEqual(expected, h, places=15) + @unittest.skipUnless(SCIPY_AVAILABLE, "Tests with RANSAC require scipy.") def test_dfa_RANSAC(self): """Test hypothesis: The exact output of dfa() with `fit_exp=RANSAC` on random data hasn't changed since the last version.""" # adds trend to data to introduce a less clear line for fitting @@ -641,6 +645,7 @@ def test_mfhurst_b(self): expected = [-0.00559398934417339] self.assertAlmostEqual(expected[0], h[0], places=15) + @unittest.skipUnless(SCIPY_AVAILABLE, "Tests with RANSAC require scipy.") def test_mfhurst_b_RANSAC(self): """Test hypothesis: The exact output of mfhurst_b() with `fit=RANSAC` on random data hasn't changed since the last version.""" data = datasets.load_qrandom()[:1000] @@ -656,6 +661,7 @@ def test_mfhurst_dm(self): expected = [0.008762803881203145] self.assertAlmostEqual(expected[0], h[0], places=15) + @unittest.skipUnless(SCIPY_AVAILABLE, "Tests with RANSAC require scipy.") def test_mfhurst_dm_RANSAC(self): """Test hypothesis: The exact output of mfhurst_dm() with `fit=RANSAC` on random data hasn't changed since the last version.""" data = datasets.load_qrandom()[:1000] From c79fea27734571dbf16d207dcac3b89130a1b8aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Sch=C3=B6lzel?= Date: Mon, 30 Sep 2024 21:17:54 +0200 Subject: [PATCH 3/5] also runs CI on pull requests --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 50c8bdb..464c4e9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,7 @@ on: push: branches: ["main", "dev", "v*"] + pull_request: name: build From 2e24f2419ee2b03a6cb3f1d04f54759c1d930209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Sch=C3=B6lzel?= Date: Mon, 30 Sep 2024 21:22:17 +0200 Subject: [PATCH 4/5] updates package name for scikit-learn --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9bd360a..ac929d4 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ def run(self): 'setuptools' ], extras_require={ - 'RANSAC': ['sklearn>=0.19'], + 'RANSAC': ['scikit-learn>=0.19'], 'qrandom': ['quantumrandom'], 'plots': ['matplotlib'] }, From c5a99da5c8a07caafa49c5603baf78764f8736f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Sch=C3=B6lzel?= Date: Mon, 30 Sep 2024 22:45:10 +0200 Subject: [PATCH 5/5] sets codecov token from secrets --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 464c4e9..bdc6637 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,6 +19,8 @@ jobs: python-version: ${{ matrix.python }} - run: pip install ".${{ matrix.extras }}" - run: pip install codecov . + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: coverage run -m unittest nolds.test_measures - run: codecov if: ${{ matrix.python == '3.10' && matrix.extras != '' }}