Skip to content

Commit

Permalink
Test jupyter notebook in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Feb 11, 2024
1 parent 24a4349 commit 65159ce
Show file tree
Hide file tree
Showing 10 changed files with 563 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ jobs:
- name: "Assert Julia version"
if: ${{ matrix.julia-version != '1'}}
run: python3 -c "from pysr import jl; assert jl.VERSION.major == jl.seval('v\"${{ matrix.julia-version }}\"').major; assert jl.VERSION.minor == jl.seval('v\"${{ matrix.julia-version }}\"').minor"
- name: "Install Coverage tool"
run: pip install coverage coveralls
- name: "Install test dependencies"
run: pip install coverage coveralls pytest nbval
- name: "Set up coverage for subprocesses"
run: echo 'import coverage; coverage.process_startup()' > "${{ github.workspace }}/sitecustomize.py"
- name: "Run tests"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/CI_Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install pytest nbval
pip install .
python -c 'import pysr'
- name: "Run tests"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/CI_conda_forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ jobs:
run: conda activate pysr-test && conda install pysr
if: ${{ !matrix.use-mamba }}
- name: "Run tests"
run: python -m pysr test main,startup
run: |
pip install pytest nbval
python -m pysr test main,startup
2 changes: 1 addition & 1 deletion .github/workflows/CI_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
- name: Build docker
run: docker build --platform=${{ matrix.arch }} -t pysr .
- name: Test docker
run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'python3 -m pysr test main,cli,startup'
run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'pip install pytest nbval && python3 -m pysr test main,cli,startup'
2 changes: 1 addition & 1 deletion .github/workflows/CI_docker_large_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
- name: Build docker
run: docker build --platform=${{ matrix.arch }} -t pysr --build-arg JLVERSION=${{ matrix.julia-version }} --build-arg PYVERSION=${{ matrix.python-version }} .
- name: Test docker
run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'python3 -m pysr test main,cli,startup'
run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'pip install pytest nbval && python3 -m pysr test main,cli,startup'
4 changes: 2 additions & 2 deletions .github/workflows/CI_large_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install pytest nbval
pip install .
python -c 'import pysr'
- name: "Assert Julia version"
if: ${{ matrix.julia-version != '1'}}
run: python3 -c "from pysr import jl; assert jl.VERSION.major == jl.seval('v\"${{ matrix.julia-version }}\"').major; assert jl.VERSION.minor == jl.seval('v\"${{ matrix.julia-version }}\"').minor"
- name: "Run tests"
run: |
python -m pysr test main,cli,startup
run: python -m pysr test main,cli,startup
1 change: 1 addition & 0 deletions .github/workflows/CI_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install pytest nbval
pip install .
python -c 'import pysr'
- name: "Run tests"
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ repos:
hooks:
- id: black
- id: black-jupyter
exclude: pysr/test/test_nb.ipynb
# Stripping notebooks
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
exclude: pysr/test/test_nb.ipynb
# Unused imports
- repo: https://github.com/hadialqattan/pycln
rev: "v2.4.0"
Expand Down

0 comments on commit 65159ce

Please sign in to comment.