Skip to content

Commit bf694c3

Browse files
committed
Add a doctest CI run
1 parent dd17198 commit bf694c3

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.github/workflows/test.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,36 @@ jobs:
9494
run: |
9595
hatch env run --env ${{ matrix.dependency-set }} run
9696
97+
doctests:
98+
name: doctests
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@v4
102+
- name: Set up Python
103+
uses: actions/setup-python@v5
104+
with:
105+
python-version: '3.13'
106+
cache: 'pip'
107+
- name: Install Hatch
108+
run: |
109+
python -m pip install --upgrade pip
110+
pip install hatch
111+
- name: Set Up Hatch Env
112+
run: |
113+
hatch env create doctest
114+
hatch env run -e doctest list-env
115+
- name: Run Tests
116+
run: |
117+
hatch env run --env doctest run
118+
97119
test-complete:
98120
name: Test complete
99121

100122
needs:
101123
[
102124
test,
103125
test-upstream-and-min-deps,
126+
doctests
104127
]
105128
if: always()
106129
runs-on: ubuntu-latest
@@ -111,4 +134,4 @@ jobs:
111134
contains(needs.*.result, 'cancelled')
112135
run: exit 1
113136
- name: Success
114-
run: echo Success!
137+
run: echo Success!

pyproject.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,22 @@ numpy = ["1.25", "2.1"]
138138
features = ["gpu"]
139139

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

149+
[tool.hatch.envs.doctest]
150+
features = ["test", "optional"]
151+
description = "Test environment for doctests"
152+
153+
[tool.hatch.envs.doctest.scripts]
154+
run = "pytest docs/user-guide --doctest-glob='*.rst'"
155+
list-env = "pip list"
156+
149157
[tool.hatch.envs.gputest]
150158
dependencies = [
151159
"numpy~={matrix:numpy}",
@@ -351,7 +359,7 @@ ignore_errors = true
351359

352360
[tool.pytest.ini_options]
353361
minversion = "7"
354-
testpaths = ["tests", "docs"]
362+
testpaths = ["tests", "docs/user-guide"]
355363
log_cli_level = "INFO"
356364
xfail_strict = true
357365
asyncio_mode = "auto"

0 commit comments

Comments
 (0)