Skip to content

Add tox environment for doctest #1870

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

Merged
merged 2 commits into from
Oct 9, 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
18 changes: 3 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Setup SocketCAN
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get -y install linux-modules-extra-$(uname -r)
sudo ./test/open_vcan.sh
- name: Test with pytest via tox
run: |
tox -e gh
pipx run tox -e gh
env:
# SocketCAN tests currently fail with PyPy because it does not support raw CAN sockets
# See: https://foss.heptapod.net/pypy/pypy/-/issues/3809
Expand Down Expand Up @@ -131,18 +127,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[canalystii,gs_usb,mf4]
pip install -r doc/doc-requirements.txt
python-version: "3.12"
- name: Build documentation
run: |
python -m sphinx -Wan --keep-going doc build
- name: Run doctest
run: |
python -m sphinx -b doctest -W --keep-going doc build
pipx run tox -e docs

build:
name: Packaging
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.12"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
3 changes: 1 addition & 2 deletions doc/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ The unit tests can be run with::

The documentation can be built with::

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

The linters can be run with::

Expand Down
4 changes: 4 additions & 0 deletions doc/scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ Command line help, called with ``--help``:


.. command-output:: python -m can.logger -h
:shell:


can.player
----------

.. command-output:: python -m can.player -h
:shell:


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

.. command-output:: python -m can.viewer -h
:shell:


can.logconvert
--------------

.. command-output:: python -m can.logconvert -h
:shell:
15 changes: 14 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[tox]
isolated_build = true

[testenv]
deps =
Expand Down Expand Up @@ -30,6 +29,20 @@ passenv =
PY_COLORS
TEST_SOCKETCAN

[testenv:docs]
description = Build and test the documentation
basepython = py312
deps =
-r doc/doc-requirements.txt
gs-usb

extras =
canalystii

commands =
python -m sphinx -b html -Wan --keep-going doc build
python -m sphinx -b doctest -W --keep-going doc build


[pytest]
testpaths = test
Expand Down
Loading