Add tests for free-threaded python #191
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests and linters | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/tests.yml' | |
- 'pyproject.toml' | |
- '**.py' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
architecture: x64 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
pip install --progress-bar off numpy matplotlib scipy mypy flake8 black | |
- run: flake8 . --show-source --statistics | |
- run: black --check . | |
- run: mypy cmaes | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools numpy scipy hypothesis pytest | |
pip install --progress-bar off . | |
- run: python -m pytest tests --ignore=tests/test_free_threaded.py | |
test-free-threaded: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# TODO: Replace deadsnakes with setup-python when the support for Python 3.13t is added | |
- name: Setup Python 3.13t | |
uses: deadsnakes/[email protected] | |
with: | |
python-version: "3.13-dev" | |
nogil: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools numpy hypothesis pytest pytest-freethreaded | |
pip install --progress-bar off . | |
- run: python -m pytest --threads 1 --iterations 1 tests --ignore=tests/test_free_threaded.py | |
# TODO: Using `unittest` style causes `pytest-freethreaded` to fail with `ConcurrencyError`. | |
# Rewriting as top-level functions works, | |
# so a follow-up is needed to refactor from `unittest` to `pytest`. | |
- run: python -m pytest --threads 1 --iterations 1 --require-gil-disabled tests/test_free_threaded.py | |
test-numpy2: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
architecture: x64 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools scipy hypothesis pytest | |
python -m pip install --pre --upgrade numpy | |
pip install --progress-bar off . | |
- run: python -m pytest tests --ignore=tests/test_free_threaded.py |