Skip to content

Commit

Permalink
Add a doctest CI run
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Jan 2, 2025
1 parent dd17198 commit bf694c3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,36 @@ jobs:
run: |
hatch env run --env ${{ matrix.dependency-set }} run
doctests:
name: doctests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- name: Install Hatch
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Set Up Hatch Env
run: |
hatch env create doctest
hatch env run -e doctest list-env
- name: Run Tests
run: |
hatch env run --env doctest run
test-complete:
name: Test complete

needs:
[
test,
test-upstream-and-min-deps,
doctests
]
if: always()
runs-on: ubuntu-latest
Expand All @@ -111,4 +134,4 @@ jobs:
contains(needs.*.result, 'cancelled')
run: exit 1
- name: Success
run: echo Success!
run: echo Success!
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,22 @@ numpy = ["1.25", "2.1"]
features = ["gpu"]

[tool.hatch.envs.test.scripts]
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov=src --doctest-glob='*.rst'"
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov=src"
run-coverage-gpu = "pip install cupy-cuda12x && pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov=src"
run = "run-coverage --no-cov"
run-verbose = "run-coverage --verbose"
run-mypy = "mypy src"
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
list-env = "pip list"

[tool.hatch.envs.doctest]
features = ["test", "optional"]
description = "Test environment for doctests"

[tool.hatch.envs.doctest.scripts]
run = "pytest docs/user-guide --doctest-glob='*.rst'"
list-env = "pip list"

[tool.hatch.envs.gputest]
dependencies = [
"numpy~={matrix:numpy}",
Expand Down Expand Up @@ -351,7 +359,7 @@ ignore_errors = true

[tool.pytest.ini_options]
minversion = "7"
testpaths = ["tests", "docs"]
testpaths = ["tests", "docs/user-guide"]
log_cli_level = "INFO"
xfail_strict = true
asyncio_mode = "auto"
Expand Down

0 comments on commit bf694c3

Please sign in to comment.