Skip to content

Commit 827cbc7

Browse files
Test on windows (#32)
1 parent 5155331 commit 827cbc7

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ jobs:
99
- uses: actions/checkout@master
1010
- uses: actions/setup-python@v2
1111
- run: pip install poetry
12+
- run: poetry version ${GITHUB_REF:10}
1213
- run: poetry build
1314
- uses: pypa/gh-action-pypi-publish@master
1415
with:
1516
password: ${{ secrets.PYPI_PASSWORD }}
17+
- uses: EndBug/[email protected]
18+
with:
19+
author_name: github-actions
20+
author_email: 41898282+github-actions[bot]@users.noreply.github.com
21+
add: pyproject.toml
22+
branch: main
23+
message: Published new version

.github/workflows/pytest.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
cfg:
14+
- os: windows-latest
15+
python-version: "3.6"
16+
- os: windows-latest
17+
python-version: "3.7"
18+
- os: windows-latest
19+
python-version: "3.8"
20+
- os: windows-latest
21+
python-version: "3.9"
1422
- os: ubuntu-latest
1523
python-version: "3.6"
1624
- os: ubuntu-latest
@@ -37,23 +45,23 @@ jobs:
3745
python-version: ${{ matrix.cfg.python-version }}
3846
- run: pip install poetry
3947
- run: poetry install
40-
- uses: pre-commit/[email protected]
48+
- if: matrix.cfg.os != 'windows-latest'
49+
uses: pre-commit/[email protected]
4150
with:
4251
extra_args: --verbose --all-files
4352

4453
- run: poetry run pytest tests/test_nb_run.py # run without extras
4554
- run: poetry install
4655
- run: poetry run pytest --cov-report=xml --cov=src
47-
48-
- run: poetry run python -m ipykernel install --user --name nbmake
49-
- run: poetry run jb build -W -n --keep-going --builder html docs
50-
5156
- uses: codecov/codecov-action@v1
5257
with:
5358
file: coverage.xml
5459

55-
- name: GitHub Pages action
56-
if: github.ref == 'refs/heads/main' && matrix.cfg.publish-docs
60+
- if: github.ref == 'refs/heads/main' && matrix.cfg.publish-docs
61+
run: |
62+
poetry run python -m ipykernel install --user --name nbmake
63+
poetry run jb build -W -n --keep-going --builder html docs
64+
- if: github.ref == 'refs/heads/main' && matrix.cfg.publish-docs
5765
uses: peaceiris/[email protected]
5866
with:
5967
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -96,7 +104,6 @@ jobs:
96104
-n=auto \
97105
teachopencadd/talktorials/T000_template/talktorial.ipynb \
98106
teachopencadd/talktorials/T002_compound_adme/talktorial.ipynb \
99-
teachopencadd/talktorials/T003_compound_unwanted_substructures/talktorial.ipynb \
100107
teachopencadd/talktorials/T004_compound_similarity/talktorial.ipynb \
101108
teachopencadd/talktorials/T005_compound_clustering/talktorial.ipynb \
102109
teachopencadd/talktorials/T007_compound_activity_machine_learning/talktorial.ipynb \

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
**Who is this for?** Research/Machine Learning Software Engineers who maintain packages/teaching materials with documentation written in notebooks.
1111

12-
**⚠️ Warning: Does not support Windows**
13-
1412
## Functionality
1513

1614
1. Executes notebooks using pytest and nbclient, allowing parallel notebook testing

pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[pytest]
22
testpaths =
3-
tests
3+
tests
4+
timeout = 180

src/nbmake/pytest_plugin.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1+
import asyncio
2+
import sys
13
from pathlib import Path
24
from typing import Any, Optional
35

46
from .pytest_items import NotebookFile
57

68

79
def pytest_addoption(parser: Any):
10+
# See https://bugs.python.org/issue37373 and
11+
# https://github.com/nteract/papermill/issues/515
12+
if (
13+
sys.version_info[0] == 3
14+
and sys.version_info[1] >= 8
15+
and sys.platform.startswith("win")
16+
):
17+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
18+
819
group = parser.getgroup("nbmake", "notebook testing")
920
group.addoption(
1021
"--nbmake", action="store_true", help="Test notebooks", default=False

0 commit comments

Comments
 (0)