Skip to content

Commit

Permalink
Split out CPython and PyPy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Aug 28, 2024
1 parent 667b405 commit 19dab2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
26 changes: 6 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,17 @@ jobs:
matrix:
platform: [ubuntu-latest, macos-13, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.9", "pypy-3.10"]
# TODO: bring these back someday when SciPy is easier to install
# via PyPy, and test just Ubuntu for it for now
exclude:
- platform: macos-13
python-version: "pypy-3.9"
- platform: macos-13
python-version: "pypy-3.10"
- platform: macos-latest
python-version: "pypy-3.10"
- platform: macos-latest
python-version: "pypy-3.9"
- platform: windows-latest
python-version: "pypy-3.9"
- platform: windows-latest
python-version: "pypy-3.10"
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/setup-python@v5.1.1
with:
python-version: ${{ matrix.python-version }}
- uses: yezz123/setup-uv@v4

- name: Install SciPy prerequisites for Linux with PyPy
if: matrix.platform == 'ubuntu-latest' && startsWith(matrix.python-version, 'pypy')
run: sudo apt-get install libopenblas-dev

- name: Run tests
- name: Run CPython tests
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: uvx nox -s tests

- name: Run PyPy tests
if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: nox -s tests -- k "not scipy"
8 changes: 7 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import platform

import nox

nox.needs_version = ">=2024.4.15"
Expand All @@ -19,7 +21,11 @@ def check(session):
@nox.session(name="tests")
def run_tests(session):
"""Run unit tests and generate a coverage report"""
session.install("-e", ".[test,scipy]")
# SciPy doesn't have wheels on PyPy
if platform.python_implementation() == "PyPy":
session.install("-e", ".[test]")
else:
session.install("-e", ".[test,scipy]")
session.run("pytest", "--cov=autograd", "--cov-report=xml", "--cov-append", *session.posargs)


Expand Down

0 comments on commit 19dab2a

Please sign in to comment.