Skip to content

Commit a39e63e

Browse files
authored
Add tox environment for doctest (#1870)
* test * use py312 to build docs
1 parent 7a3d23f commit a39e63e

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

.github/workflows/ci.yml

+3-15
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,14 @@ jobs:
3535
with:
3636
python-version: ${{ matrix.python-version }}
3737
allow-prereleases: true
38-
- name: Install dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip install tox
4238
- name: Setup SocketCAN
4339
if: ${{ matrix.os == 'ubuntu-latest' }}
4440
run: |
4541
sudo apt-get -y install linux-modules-extra-$(uname -r)
4642
sudo ./test/open_vcan.sh
4743
- name: Test with pytest via tox
4844
run: |
49-
tox -e gh
45+
pipx run tox -e gh
5046
env:
5147
# SocketCAN tests currently fail with PyPy because it does not support raw CAN sockets
5248
# See: https://foss.heptapod.net/pypy/pypy/-/issues/3809
@@ -131,18 +127,10 @@ jobs:
131127
- name: Set up Python
132128
uses: actions/setup-python@v5
133129
with:
134-
python-version: "3.10"
135-
- name: Install dependencies
136-
run: |
137-
python -m pip install --upgrade pip
138-
pip install -e .[canalystii,gs_usb,mf4]
139-
pip install -r doc/doc-requirements.txt
130+
python-version: "3.12"
140131
- name: Build documentation
141132
run: |
142-
python -m sphinx -Wan --keep-going doc build
143-
- name: Run doctest
144-
run: |
145-
python -m sphinx -b doctest -W --keep-going doc build
133+
pipx run tox -e docs
146134
147135
build:
148136
name: Packaging

.readthedocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.10"
12+
python: "3.12"
1313

1414
# Build documentation in the docs/ directory with Sphinx
1515
sphinx:

doc/development.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ The unit tests can be run with::
4848

4949
The documentation can be built with::
5050

51-
pip install -r doc/doc-requirements.txt
52-
python -m sphinx -an doc build
51+
pipx run tox -e docs
5352

5453
The linters can be run with::
5554

doc/scripts.rst

+4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ Command line help, called with ``--help``:
1212

1313

1414
.. command-output:: python -m can.logger -h
15+
:shell:
1516

1617

1718
can.player
1819
----------
1920

2021
.. command-output:: python -m can.player -h
22+
:shell:
2123

2224

2325
can.viewer
@@ -52,9 +54,11 @@ By default the ``can.viewer`` uses the :doc:`/interfaces/socketcan` interface. A
5254
The full usage page can be seen below:
5355

5456
.. command-output:: python -m can.viewer -h
57+
:shell:
5558

5659

5760
can.logconvert
5861
--------------
5962

6063
.. command-output:: python -m can.logconvert -h
64+
:shell:

tox.ini

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[tox]
2-
isolated_build = true
32

43
[testenv]
54
deps =
@@ -30,6 +29,20 @@ passenv =
3029
PY_COLORS
3130
TEST_SOCKETCAN
3231

32+
[testenv:docs]
33+
description = Build and test the documentation
34+
basepython = py312
35+
deps =
36+
-r doc/doc-requirements.txt
37+
gs-usb
38+
39+
extras =
40+
canalystii
41+
42+
commands =
43+
python -m sphinx -b html -Wan --keep-going doc build
44+
python -m sphinx -b doctest -W --keep-going doc build
45+
3346

3447
[pytest]
3548
testpaths = test

0 commit comments

Comments
 (0)