Skip to content

Commit b4bf5a2

Browse files
authored
Merge pull request #564 from bollwyvl/master
add github actions, bail on asyncio patch for tornado 6.1
2 parents 9cc8ea7 + 8c3aac8 commit b4bf5a2

File tree

8 files changed

+95
-112
lines changed

8 files changed

+95
-112
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: ipykernel tests
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu, macos, windows]
16+
python-version: [ '3.6', '3.7', '3.8', '3.9', 'pypy3' ]
17+
exclude:
18+
- os: windows
19+
python-version: pypy3
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v1
23+
- name: Install Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v1
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
architecture: 'x64'
28+
- name: Upgrade packaging dependencies
29+
run: |
30+
pip install --upgrade pip setuptools wheel --user
31+
- name: Get pip cache dir
32+
id: pip-cache
33+
run: |
34+
echo "::set-output name=dir::$(pip cache dir)"
35+
- name: Cache pip
36+
uses: actions/cache@v1
37+
with:
38+
path: ${{ steps.pip-cache.outputs.dir }}
39+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
40+
restore-keys: |
41+
${{ runner.os }}-pip-${{ matrix.python-version }}-
42+
${{ runner.os }}-pip-
43+
- name: Install the Python dependencies
44+
run: |
45+
pip install --pre --upgrade --upgrade-strategy=eager .[test] codecov
46+
- name: Install matplotlib
47+
if: ${{ matrix.os != 'macos' && matrix.python-version != 'pypy3' }}
48+
run: |
49+
pip install matplotlib || echo 'failed to install matplolib'
50+
- name: Install alternate event loops
51+
if: ${{ matrix.os != 'windows' }}
52+
run: |
53+
pip install curio || echo 'ignoring curio install failure'
54+
pip install trio || echo 'ignoring trio install failure'
55+
- name: List installed packages
56+
run: |
57+
pip freeze
58+
pip check
59+
- name: Run the tests
60+
timeout-minutes: 30
61+
run: |
62+
pytest ipykernel -vv -s --cov ipykernel --cov-branch --cov-report term-missing:skip-covered --durations 10
63+
- name: Coverage
64+
run: |
65+
codecov

.travis.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

appveyor.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

examples/embedding/inprocess_qtconsole.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
import sys
33

4+
import tornado
5+
46
from qtconsole.rich_ipython_widget import RichIPythonWidget
57
from qtconsole.inprocess import QtInProcessKernelManager
68
from IPython.lib import guisupport
@@ -21,7 +23,7 @@ def init_asyncio_patch():
2123
FIXME: if/when tornado supports the defaults in asyncio,
2224
remove and bump tornado requirement for py38
2325
"""
24-
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
26+
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
2527
import asyncio
2628
try:
2729
from asyncio import (

examples/embedding/inprocess_terminal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
import sys
33

4+
import tornado
5+
46
from ipykernel.inprocess import InProcessKernelManager
57
from jupyter_console.ptshell import ZMQTerminalInteractiveShell
68

@@ -20,7 +22,7 @@ def init_asyncio_patch():
2022
FIXME: if/when tornado supports the defaults in asyncio,
2123
remove and bump tornado requirement for py38
2224
"""
23-
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
25+
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
2426
import asyncio
2527
try:
2628
from asyncio import (

ipykernel/inprocess/tests/test_kernel.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
import sys
66
import unittest
77

8+
import pytest
9+
10+
import tornado
11+
812
from ipykernel.inprocess.blocking import BlockingInProcessKernelClient
913
from ipykernel.inprocess.manager import InProcessKernelManager
1014
from ipykernel.inprocess.ipkernel import InProcessKernel
@@ -29,7 +33,7 @@ def _init_asyncio_patch():
2933
FIXME: if/when tornado supports the defaults in asyncio,
3034
remove and bump tornado requirement for py38
3135
"""
32-
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
36+
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
3337
import asyncio
3438
try:
3539
from asyncio import (
@@ -76,6 +80,10 @@ def test_raw_input(self):
7680
sys.stdin = sys_stdin
7781
assert self.km.kernel.shell.user_ns.get('x') == 'foobar'
7882

83+
@pytest.mark.skipif(
84+
'__pypy__' in sys.builtin_module_names,
85+
reason="fails on pypy"
86+
)
7987
def test_stdout(self):
8088
""" Does the in-process kernel correctly capture IO?
8189
"""

ipykernel/kernelapp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import traceback
1212
import logging
1313

14+
import tornado
1415
from tornado import ioloop
16+
1517
import zmq
1618
from zmq.eventloop import ioloop as zmq_ioloop
1719
from zmq.eventloop.zmqstream import ZMQStream
@@ -521,7 +523,7 @@ def _init_asyncio_patch(self):
521523
FIXME: if/when tornado supports the defaults in asyncio,
522524
remove and bump tornado requirement for py38
523525
"""
524-
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
526+
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
525527
import asyncio
526528
try:
527529
from asyncio import (
@@ -539,7 +541,7 @@ def _init_asyncio_patch(self):
539541

540542
def init_pdb(self):
541543
"""Replace pdb with IPython's version that is interruptible.
542-
544+
543545
With the non-interruptible version, stopping pdb() locks up the kernel in a
544546
non-recoverable state.
545547
"""

ipykernel/tests/test_kernel.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ def test_sys_path_profile_dir():
7878

7979

8080
@flaky(max_runs=3)
81-
@dec.skipif(sys.platform == 'win32', "subprocess prints fail on Windows")
81+
@dec.skipif(
82+
sys.platform == 'win32' or (sys.platform == "darwin" and sys.version_info >=(3, 8)),
83+
"subprocess prints fail on Windows and MacOS Python 3.8+"
84+
)
8285
def test_subprocess_print():
8386
"""printing from forked mp.Process"""
8487
with new_kernel() as kc:
@@ -130,7 +133,10 @@ def test_subprocess_noprint():
130133

131134

132135
@flaky(max_runs=3)
133-
@dec.skipif(sys.platform == 'win32', "subprocess prints fail on Windows")
136+
@dec.skipif(
137+
sys.platform == 'win32' or (sys.platform == "darwin" and sys.version_info >=(3, 8)),
138+
"subprocess prints fail on Windows and MacOS Python 3.8+"
139+
)
134140
def test_subprocess_error():
135141
"""error in mp.Process doesn't crash"""
136142
with new_kernel() as kc:
@@ -297,7 +303,7 @@ def test_message_order():
297303
assert reply['parent_header']['msg_id'] == msg_id
298304

299305

300-
@dec.skipif(sys.platform.startswith('linux'))
306+
@dec.skipif(sys.platform.startswith('linux') or sys.platform.startswith('darwin'))
301307
def test_unc_paths():
302308
with kernel() as kc, TemporaryDirectory() as td:
303309
drive_file_path = os.path.join(td, 'unc.txt')
@@ -345,7 +351,7 @@ def test_shutdown():
345351
def test_interrupt_during_input():
346352
"""
347353
The kernel exits after being interrupted while waiting in input().
348-
354+
349355
input() appears to have issues other functions don't, and it needs to be
350356
interruptible in order for pdb to be interruptible.
351357
"""
@@ -384,4 +390,4 @@ def test_interrupt_during_pdb_set_trace():
384390
reply = kc.get_shell_msg(timeout=TIMEOUT)
385391
validate_message(reply, 'execute_reply', msg_id)
386392
reply = kc.get_shell_msg(timeout=TIMEOUT)
387-
validate_message(reply, 'execute_reply', msg_id2)
393+
validate_message(reply, 'execute_reply', msg_id2)

0 commit comments

Comments
 (0)