Skip to content

Replace asserts by errors or warnings #145

Replace asserts by errors or warnings

Replace asserts by errors or warnings #145

Workflow file for this run

name: pytest
on:
push:
branches:
# Run tests for change on the main branch ...
- main
tags-ignore:
# ... but not for tags (avoids duplicate work).
- '**'
pull_request:
# Run tests on pull requests
jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install oldest versions of supported dependencies
if: ${{ matrix.python-version == '3.9'}}
# Ensure changes to these dependencies are reflected
# in pyproject.toml and docs/install.rst
run: pip install numpy==1.22 scipy==1.11.1 attrs==21.3.0
- name: Install development version
run: pip install -e .[dev]
# If some tests are slow against expectations, pytest will abort due to timeout.
- name: Run pytest WITH coverage for fast tests
if: ${{ matrix.os == 'ubuntu-latest'}}
run: >
pytest
-vv
-m "not slow"
--timeout=60
--cov=iodata
--cov-report=xml
--cov-report=term-missing
- name: Upload coverage report to Deepsource
if: ${{ matrix.os == 'ubuntu-latest' && env.DEEPSOURCE_DSN != '' }}
# See https://docs.deepsource.com/docs/analyzers-test-coverage#python
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
run: |
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
- name: Upload coverage reports to Codecov
if: ${{ matrix.os == 'ubuntu-latest' && env.CODECOV_TOKEN != '' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
curl -Os https://cli.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov --verbose upload-process --fail-on-error \
-t ${{ secrets.CODECOV_TOKEN }} \
-n 'fast'-${{ github.run_id }} \
-F fast -f coverage.xml
- name: Run pytest WITHOUT coverage for fast tests
if: ${{ matrix.os != 'ubuntu-latest'}}
run: pytest -vv -m "not slow" --timeout=60
- name: Run pytest WITHOUT coverage for slow tests
run: pytest -vv -m slow