Skip to content

Add pytest action

Add pytest action #3

name: Test notebooks
# Run the notebooks
on:
# pushes to main
push:
branches:
- main
# PRs
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
# make pytest output in color
PY_COLORS: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools build
python -m pip install --upgrade pytest nbmake
python -m pip install --upgrade numpy scipy matplotlib pyyaml h5py
- name: Build and install tenpy
run: |
python -m pip install 'physics-tenpy @ git+https://github.com/tenpy/tenpy'
- name: Run pytest on notebooks
# Note: we exclude the dmrg mixer notebook 12, since it runs very long.
# TODO: Excluding 14 temporarily, until it is debugged.
run: |
pytest --nbmake . \
--ignore=12_dmrg_mixer.ipynb \
--ignore=14_segment_half_infinite.ipynb \
-W ignore