Repository: astro-informatics/sleplet (language: python)

Issue:
Use `tox`



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
deleted file mode 100644
index 94dffa263..000000000
--- a/.github/workflows/checks.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: Check pre-commit passes
-
-on:
-  push:
-  pull_request:
-
-jobs:
-  build:
-    runs-on: ubuntu-latest
-    steps:
-      - name: checkout source
-        uses: actions/checkout@v3
-
-      - name: set up python
-        uses: actions/setup-python@v4
-        with:
-          python-version: "3.11"
-
-      - name: set PY
-        run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
-
-      - name: cache stuff
-        uses: actions/cache@v3
-        with:
-          path: |
-            ${{ env.pythonLocation }}
-            ~/.cache/pre-commit
-          key: |
-            pre-commit-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
-
-      - name: install dependencies
-        run: pip install pre-commit
-
-      - name: Install pre-commit hooks
-        run: pre-commit install
-
-      # This will run on all files in the repo not just those that have been
-      # committed. Once formatting has been applied once globally, from then on
-      # the files being changed by pre-commit should be just those that are
-      # being committed - provided that people are using the pre-commit hook to
-      # format their code.
-      - name: run pre-commit
-        run: pre-commit run --all-files --color always
-
-      # not included in pre-commit as it's quite slow
-      - name: run sourcery
-        uses: sourcery-ai/action@v1
-        with:
-          token: ${{ secrets.SOURCERY_TOKEN }}
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
deleted file mode 100644
index d1c7e142e..000000000
--- a/.github/workflows/deploy.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-name: Runs tests
-
-on:
-  push:
-    branches:
-      - main
-  pull_request:
-
-jobs:
-  build:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout source
-        uses: actions/checkout@v3
-
-      - name: set up python
-        uses: actions/setup-python@v4
-        with:
-          python-version: "3.10"
-
-      - name: set PY
-        run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
-
-      - name: cache stuff
-        uses: actions/cache@v3
-        with:
-          path: |
-            ${{ env.pythonLocation }}
-          key: |
-            sleplet-${{ env.PY }}
-
-      - name: Pip install modules
-        run: pip install .[dev]
-
-      - name: Pull LFS files
-        run: |
-          git lfs ls-files -I \
-          EGM2008_Topography_flms_L2190.mat,\
-          mesh/basis_functions/bird_b697,\
-          polar40_L32.npy,\
-          theta30-60_phi30-60_L32.npy\
-          -l | cut -d' ' -f1 | sort > .lfs-assets-id
-          git lfs pull
-
-      - name: Test with pytest
-        run: pytest -v --runslow --color=yes --cov=sleplet
diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml
new file mode 100644
index 000000000..5d9a9380e
--- /dev/null
+++ b/.github/workflows/linting.yml
@@ -0,0 +1,31 @@
+name: linting
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout source
+        uses: actions/checkout@v3
+
+      - name: Set up python
+        uses: actions/setup-python@v4
+        with:
+          python-version: "3.11"
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          python -m pip install pre-commit
+          pre-commit install
+
+      - name: Run pre-commit
+        run: pre-commit run --all-files --color always
+
+      - name: run sourcery
+        uses: sourcery-ai/action@v1
+        with:
+          token: ${{ secrets.SOURCERY_TOKEN }}
diff --git a/pyproject.toml b/pyproject.toml
index fdb510ed6..ea61057dc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -38,8 +38,7 @@ dev = [
   "black",
   "mypy",
   "pre-commit",
-  "pytest",
-  "pytest-cov",
+  "tox",
 ]
 
 [project.scripts]
@@ -52,6 +51,9 @@ profile = "black"
 [tool.mypy]
 plugins = ["numpy.typing.mypy_plugin", "pydantic.mypy"]
 
+[tool.pytest.ini_options]
+addopts = "--color=yes -v"
+
 [tool.ruff]
 fix = true
 force-exclude = true
@@ -82,3 +84,23 @@ max-complexity = 18
 [tool.tomlsort]
 all = true
 trailing_comma_inline_array = true
+
+[tool.tox]
+legacy_tox_ini = """
+    [gh-actions]
+    python =
+        3.10: py310
+
+    [testenv]
+    commands =
+        pytest \
+        --cov=sleplet \
+        --runslow
+    deps =
+        pytest
+        pytest-cov
+
+    [tox]
+    env_list =
+        py310
+"""


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 000000000..57d8f1aba
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,40 @@
+name: tests
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout source
+        uses: actions/checkout@v3
+
+      - name: Retrieve LFS files
+        run: |
+          git lfs ls-files -I \
+          bird_b697,\
+          EGM2008_Topography_flms_L2190.mat,\
+          theta30-60_phi30-60_L32.npy \
+          -l | cut -d' ' -f1 | sort > .lfs-assets-id
+          git lfs pull
+
+      - name: Set up python
+        uses: actions/setup-python@v4
+        with:
+          python-version: "3.10"
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          python -m pip install tox tox-gh-actions
+
+      - name: Cache tox
+        uses: actions/cache@v3
+        with:
+          path: .tox
+          key: tox-${{ hashFiles('pyproject.toml') }}
+
+      - name: Test with tox
+        run: tox