Skip to content

Commit 6510bd9

Browse files
Use GH actions to test on OSX and Windows as well (#63)
1 parent 10956c6 commit 6510bd9

File tree

5 files changed

+59
-10
lines changed

5 files changed

+59
-10
lines changed

.github/workflows/main.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on: push
4+
5+
jobs:
6+
build-n-test-n-coverage:
7+
name: Build, test and code coverage
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
python-version: [ 3.6, 3.7, 3.8 ]
14+
exclude:
15+
- os: windows-latest
16+
python-version: 3.8
17+
env:
18+
OS: ${{ matrix.os }}
19+
PYTHON: '3.8'
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v1
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -e .[test]
32+
pip install tox coverage codecov tox-gh-actions
33+
- name: Run the tests
34+
run: tox
35+
- name: Upload coverage to Codecov
36+
uses: codecov/codecov-action@v1
37+
with:
38+
file: ./coverage.xml
39+
flags: unittests
40+
env_vars: OS,PYTHON
41+
name: codecov-umbrella
42+
fail_ci_if_error: true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter/nbclient/master?filepath=binder%2Frun_nbclient.ipynb)
22
[![Travis Build Status](https://travis-ci.org/jupyter/nbclient.svg?branch=master)](https://travis-ci.org/jupyter/nbclient)
3+
[![Build Status](https://github.com/jupyter/nbclient/workflows/CI/badge.svg)](https://github.com/jupyter/nbclient/actions)
34
[![Documentation Status](https://readthedocs.org/projects/nbclient/badge/?version=latest)](https://nbclient.readthedocs.io/en/latest/?badge=latest)
45
[![image](https://codecov.io/github/jupyter/nbclient/coverage.svg?branch=master)](https://codecov.io/github/jupyter/nbclient?branch=master)
56
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)

nbclient/tests/test_client.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from nbconvert.filters import strip_ansi
2727
from testpath import modified_env
2828
from ipython_genutils.py3compat import string_types
29-
from pebble import ProcessPool
29+
import concurrent.futures
3030

3131
from queue import Empty
3232
from unittest.mock import MagicMock, Mock
@@ -82,6 +82,12 @@ def run_notebook(filename, opts, resources=None):
8282
return input_nb, output_nb
8383

8484

85+
def run_notebook_wrapper(args):
86+
# since concurrent.futures.ProcessPoolExecutor doesn't have starmap,
87+
# we need to unpack the arguments
88+
return run_notebook(*args)
89+
90+
8591
async def async_run_notebook(filename, opts, resources=None):
8692
"""Loads and runs a notebook, returning both the version prior to
8793
running it and the version after running it.
@@ -301,13 +307,8 @@ def test_many_parallel_notebooks(capfd):
301307
# run once, to trigger creating the original context
302308
run_notebook(input_file, opts, res)
303309

304-
with ProcessPool(max_workers=2) as pool:
305-
futures = [
306-
pool.schedule(run_notebook, args=(input_file, opts, res))
307-
for i in range(8)
308-
]
309-
for index, future in enumerate(futures):
310-
future.result()
310+
with concurrent.futures.ProcessPoolExecutor(max_workers=2) as executor:
311+
executor.map(run_notebook_wrapper, [(input_file, opts, res) for i in range(8)])
311312

312313
captured = capfd.readouterr()
313314
assert captured.err == ""

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ check-manifest
99
flake8
1010
tox
1111
bumpversion
12-
pebble
1312
xmltodict
1413
black; python_version >= '3.6'
1514
pip>=18.1

tox.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
skipsdist = true
33
envlist = py{36,37,38}, flake8, dist, manifest, docs
44

5+
[gh-actions]
6+
python =
7+
3.6: py36
8+
3.7: py37
9+
3.8: py38, flake8, dist, manifest
10+
511
# Linters
612
[testenv:flake8]
713
skip_install = true
@@ -50,7 +56,7 @@ basepython =
5056
docs: python3.8
5157
deps = .[dev]
5258
commands =
53-
pytest -vv --maxfail=2 --cov=nbclient -W always {posargs}
59+
pytest -vv --maxfail=2 --cov=nbclient --cov-report=xml -W always {posargs}
5460

5561
# Binder
5662
[testenv:binder]

0 commit comments

Comments
 (0)