Skip to content

Commit 48deccc

Browse files
authored
🔧 MAINTAIN: Add sphinx v2 CI and tox (#233)
1 parent f5bec1a commit 48deccc

4 files changed

Lines changed: 54 additions & 2 deletions

File tree

.github/workflows/tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
strategy:
2727
matrix:
2828
python-version: [3.6, 3.7, 3.8]
29+
sphinx: [">=3,<4"]
30+
include:
31+
- python-version: 3.8
32+
sphinx: ">=2,<3"
2933

3034
steps:
3135
- uses: actions/checkout@v2
@@ -36,6 +40,7 @@ jobs:
3640
- name: Install dependencies
3741
run: |
3842
python -m pip install --upgrade pip
43+
pip install "sphinx${{ matrix.sphinx }}"
3944
pip install -e .[testing]
4045
- name: Run pytest
4146
run: |
@@ -44,7 +49,7 @@ jobs:
4449
# for some reason the tests/conftest.py::check_nbs fixture breaks pytest-cov's cov-report outputting
4550
# this is why we run `coverage xml` afterwards (required by codecov)
4651
- name: Upload to Codecov
47-
if: matrix.python-version == 3.7 && github.repository == 'executablebooks/MyST-NB'
52+
if: matrix.python-version == 3.7 && matrix.sphinx == '>=3,<4' && github.repository == 'executablebooks/MyST-NB'
4853
uses: codecov/codecov-action@v1
4954
with:
5055
name: myst-nb-pytests-py3.7

codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: 85%
6+
threshold: 0.5%
7+
patch:
8+
default:
9+
target: 80%
10+
threshold: 0.5%

docs/develop/contributing.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,20 @@ All functions and class methods should be annotated with types and include a doc
6666

6767
## Testing
6868

69-
For code tests:
69+
For code tests, MyST-NB uses [pytest](https://docs.pytest.org)):
7070

7171
```shell
7272
>> cd MyST-NB
7373
>> pytest
7474
```
7575

76+
You can also use [tox](https://tox.readthedocs.io), to run the tests in multiple isolated environments (see the `tox.ini` file for available test environments):
77+
78+
```shell
79+
>> cd MyST-NB
80+
>> tox
81+
```
82+
7683
For documentation build tests:
7784

7885
```shell

tox.ini

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# To use tox, see https://tox.readthedocs.io
2+
# Simply pip or conda install tox
3+
# If you use conda, you may also want to install tox-conda
4+
# then run `tox` or `tox -- {pytest args}`
5+
# To run in parallel using `tox -p` (this does not appear to work for this repo)
6+
7+
# To rebuild the tox environment, for example when dependencies change, use
8+
# `tox -r`
9+
10+
# Note: if the following error is encountered: `ImportError while loading conftest`
11+
# then then deleting compiled files has been found to fix it: `find . -name \*.pyc -delete`
12+
13+
[tox]
14+
envlist = py{36,37,38}-sphinx{2,3},docs
15+
16+
[testenv:py{36,37,38}-sphinx{2,3}]
17+
recreate = false
18+
extras = testing
19+
deps =
20+
sphinx2: sphinx>=2,<3
21+
sphinx3: sphinx>=3,<4
22+
commands = pytest {posargs}
23+
24+
[testenv:docs]
25+
recreate = false
26+
extras = rtd
27+
whitelist_externals = rm
28+
commands =
29+
rm -rf docs/_build
30+
sphinx-build -nW --keep-going -b html docs/ docs/_build/html

0 commit comments

Comments
 (0)