Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: use sybil for doctests #178

Merged
merged 10 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions audinterface/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from doctest import ELLIPSIS
from doctest import NORMALIZE_WHITESPACE

from sybil import Sybil
from sybil.parsers.rest import DocTestParser


pytest_collect_file = Sybil(
parsers=[DocTestParser(optionflags=NORMALIZE_WHITESPACE + ELLIPSIS)],
patterns=["*.py"],
).pytest()
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
]
pygments_style = None
extensions = [
"jupyter_sphinx",
"sphinx.ext.napoleon", # support for Google-style docstrings
"sphinx_autodoc_typehints",
"sphinx.ext.viewcode",
Expand Down
29 changes: 29 additions & 0 deletions docs/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from doctest import ELLIPSIS
from doctest import NORMALIZE_WHITESPACE
import os

import pytest
from sybil import Sybil
from sybil.parsers.rest import DocTestParser
from sybil.parsers.rest import PythonCodeBlockParser


@pytest.fixture(scope="module")
def execute_in_tmpdir(tmpdir_factory):
path = tmpdir_factory.mktemp("doctest")
cwd = os.getcwd()
try:
os.chdir(path)
yield path
finally:
os.chdir(cwd)


pytest_collect_file = Sybil(
parsers=[
DocTestParser(optionflags=NORMALIZE_WHITESPACE + ELLIPSIS),
PythonCodeBlockParser(),
],
patterns=["*.rst"],
fixtures=["execute_in_tmpdir"],
).pytest()
6 changes: 0 additions & 6 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
audb
audeer
auditok
ipykernel
jupyter-sphinx
librosa
pyarrow
soxr >=0.4.0b1 # for numpy 2, https://github.com/dofuuz/python-soxr/issues/28
sphinx
sphinx-apipages >=0.1.2
sphinx-audeering-theme >=1.2.1
Expand Down
Loading
Loading