Skip to content

Commit

Permalink
Add doctesting to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
faymanns committed Jan 24, 2025
1 parent a4e1174 commit 84544d8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ ignore = [
"A003", # shadowing of a Python builtin
]

[tool.pytest.ini_options]
addopts = "--doctest-modules"

exclude = [
".bzr",
".direnv",
Expand Down
24 changes: 24 additions & 0 deletions src/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Fixtures for doctesting
"""
import matplotlib.pyplot as plt
import numpy as np
import pytest
import splinebox


@pytest.fixture(autouse=True)
def add_np(doctest_namespace):
doctest_namespace["np"] = np
if np.__version__ >= "2.0.0":
np.set_printoptions(legacy="1.25")


@pytest.fixture(autouse=True)
def add_splinebox(doctest_namespace):
doctest_namespace["splinebox"] = splinebox


@pytest.fixture(autouse=True)
def add_plt(doctest_namespace):
doctest_namespace["plt"] = plt
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ passenv =
CI
GITHUB_ACTIONS
extras =
test
commands = pytest -v --color=yes --cov=splinebox --cov-report=xml
test,examples
commands =
pytest -v --color=yes --doctest-modules src
pytest -v --color=yes --cov=splinebox --cov-report=xml

0 comments on commit 84544d8

Please sign in to comment.