diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1157fccc86..7171dc2a5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -94,6 +94,28 @@ 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 @@ -101,6 +123,7 @@ jobs: [ test, test-upstream-and-min-deps, + doctests ] if: always() runs-on: ubuntu-latest @@ -111,4 +134,4 @@ jobs: contains(needs.*.result, 'cancelled') run: exit 1 - name: Success - run: echo Success! \ No newline at end of file + run: echo Success! diff --git a/pyproject.toml b/pyproject.toml index f6875b7c63..302cf3b07b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -138,7 +138,7 @@ 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" @@ -146,6 +146,14 @@ 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}", @@ -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"