Skip to content

Commit 562701c

Browse files
henklaakmurrayrm
authored andcommitted
Enable doctest
1 parent 177cba9 commit 562701c

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

.github/conda-env/doctest-env.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: test-env
2+
dependencies:
3+
- conda-build # for conda index
4+
- pip
5+
- coverage
6+
- coveralls
7+
- pytest
8+
- pytest-cov
9+
- pytest-timeout
10+
- pytest-xvfb
11+
- numpy
12+
- matplotlib
13+
- scipy
14+
- sphinx
15+
- sphinx_rtd_theme
16+
- ipykernel
17+
- nbsphinx
18+
- docutils
19+
- numpydoc

.github/workflows/doctest.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Doctest
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
doctest-linux:
7+
# doctest needs to run only on
8+
# latest-greatest platform with full options
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout python-control
13+
uses: actions/checkout@v3
14+
15+
- name: Setup Conda
16+
uses: conda-incubator/setup-miniconda@v2
17+
with:
18+
python-version: 3.11
19+
activate-environment: test-env
20+
environment-file: .github/conda-env/doctest-env.yml
21+
miniforge-version: latest
22+
miniforge-variant: Mambaforge
23+
channels: conda-forge
24+
channel-priority: strict
25+
auto-update-conda: false
26+
auto-activate-base: false
27+
28+
- name: Install full dependencies
29+
shell: bash -l {0}
30+
run: |
31+
mamba install cvxopt pandas slycot
32+
33+
- name: Run doctest
34+
shell: bash -l {0}
35+
env:
36+
PYTHON_CONTROL_ARRAY_AND_MATRIX: ${{ matrix.array-and-matrix }}
37+
MPLBACKEND: ${{ matrix.mplbackend }}
38+
working-directory: doc
39+
run: |
40+
make html
41+
make doctest
42+
43+
- name: Archive results
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: doctest-output
47+
path: doc/_build/doctest/output.txt

doc/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ help:
1515
.PHONY: help Makefile
1616

1717
# Rules to create figures
18-
FIGS = classes.pdf
19-
classes.pdf: classes.fig; fig2dev -Lpdf $< $@
18+
FIGS = classes.png
19+
classes.png: classes.fig
20+
fig2dev -Lpng $< $@
2021

2122
# Catch-all target: route all unknown targets to Sphinx using the new
2223
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
23-
html pdf clean: Makefile $(FIGS)
24+
html pdf clean doctest: Makefile $(FIGS)
2425
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
extensions = [
5757
'sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.napoleon',
5858
'sphinx.ext.intersphinx', 'sphinx.ext.imgmath',
59-
'sphinx.ext.autosummary', 'nbsphinx', 'numpydoc', 'sphinx.ext.linkcode'
59+
'sphinx.ext.autosummary', 'nbsphinx', 'numpydoc',
60+
'sphinx.ext.linkcode', 'sphinx.ext.doctest'
6061
]
6162

6263
# scan documents for autosummary directives and generate stub pages for each.

0 commit comments

Comments
 (0)