Skip to content
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

add github actions, bail on asyncio patch for tornado 6.1 #564

Merged
merged 1 commit into from
Dec 10, 2020
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
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ipykernel tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: [ '3.6', '3.7', '3.8', '3.9', 'pypy3' ]
exclude:
- os: windows
python-version: pypy3
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Upgrade packaging dependencies
run: |
pip install --upgrade pip setuptools wheel --user
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install the Python dependencies
run: |
pip install --pre --upgrade --upgrade-strategy=eager .[test] codecov
- name: Install matplotlib
if: ${{ matrix.os != 'macos' && matrix.python-version != 'pypy3' }}
run: |
pip install matplotlib || echo 'failed to install matplolib'
- name: Install alternate event loops
if: ${{ matrix.os != 'windows' }}
run: |
pip install curio || echo 'ignoring curio install failure'
pip install trio || echo 'ignoring trio install failure'
- name: List installed packages
run: |
pip freeze
pip check
- name: Run the tests
timeout-minutes: 30
run: |
pytest ipykernel -vv -s --cov ipykernel --cov-branch --cov-report term-missing:skip-covered --durations 10
- name: Coverage
run: |
codecov
66 changes: 0 additions & 66 deletions .travis.yml

This file was deleted.

36 changes: 0 additions & 36 deletions appveyor.yml

This file was deleted.

4 changes: 3 additions & 1 deletion examples/embedding/inprocess_qtconsole.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import sys

import tornado

from qtconsole.rich_ipython_widget import RichIPythonWidget
from qtconsole.inprocess import QtInProcessKernelManager
from IPython.lib import guisupport
Expand All @@ -21,7 +23,7 @@ def init_asyncio_patch():
FIXME: if/when tornado supports the defaults in asyncio,
remove and bump tornado requirement for py38
"""
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
import asyncio
try:
from asyncio import (
Expand Down
4 changes: 3 additions & 1 deletion examples/embedding/inprocess_terminal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import sys

import tornado

from ipykernel.inprocess import InProcessKernelManager
from jupyter_console.ptshell import ZMQTerminalInteractiveShell

Expand All @@ -20,7 +22,7 @@ def init_asyncio_patch():
FIXME: if/when tornado supports the defaults in asyncio,
remove and bump tornado requirement for py38
"""
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
import asyncio
try:
from asyncio import (
Expand Down
10 changes: 9 additions & 1 deletion ipykernel/inprocess/tests/test_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import sys
import unittest

import pytest

import tornado

from ipykernel.inprocess.blocking import BlockingInProcessKernelClient
from ipykernel.inprocess.manager import InProcessKernelManager
from ipykernel.inprocess.ipkernel import InProcessKernel
Expand All @@ -29,7 +33,7 @@ def _init_asyncio_patch():
FIXME: if/when tornado supports the defaults in asyncio,
remove and bump tornado requirement for py38
"""
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
import asyncio
try:
from asyncio import (
Expand Down Expand Up @@ -76,6 +80,10 @@ def test_raw_input(self):
sys.stdin = sys_stdin
assert self.km.kernel.shell.user_ns.get('x') == 'foobar'

@pytest.mark.skipif(
'__pypy__' in sys.builtin_module_names,
reason="fails on pypy"
)
def test_stdout(self):
""" Does the in-process kernel correctly capture IO?
"""
Expand Down
6 changes: 4 additions & 2 deletions ipykernel/kernelapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import traceback
import logging

import tornado
from tornado import ioloop

import zmq
from zmq.eventloop import ioloop as zmq_ioloop
from zmq.eventloop.zmqstream import ZMQStream
Expand Down Expand Up @@ -521,7 +523,7 @@ def _init_asyncio_patch(self):
FIXME: if/when tornado supports the defaults in asyncio,
remove and bump tornado requirement for py38
"""
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
if sys.platform.startswith("win") and sys.version_info >= (3, 8) and tornado.version_info < (6, 1):
import asyncio
try:
from asyncio import (
Expand All @@ -539,7 +541,7 @@ def _init_asyncio_patch(self):

def init_pdb(self):
"""Replace pdb with IPython's version that is interruptible.

With the non-interruptible version, stopping pdb() locks up the kernel in a
non-recoverable state.
"""
Expand Down
16 changes: 11 additions & 5 deletions ipykernel/tests/test_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ def test_sys_path_profile_dir():


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


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


@dec.skipif(sys.platform.startswith('linux'))
@dec.skipif(sys.platform.startswith('linux') or sys.platform.startswith('darwin'))
def test_unc_paths():
with kernel() as kc, TemporaryDirectory() as td:
drive_file_path = os.path.join(td, 'unc.txt')
Expand Down Expand Up @@ -345,7 +351,7 @@ def test_shutdown():
def test_interrupt_during_input():
"""
The kernel exits after being interrupted while waiting in input().

input() appears to have issues other functions don't, and it needs to be
interruptible in order for pdb to be interruptible.
"""
Expand Down Expand Up @@ -384,4 +390,4 @@ def test_interrupt_during_pdb_set_trace():
reply = kc.get_shell_msg(timeout=TIMEOUT)
validate_message(reply, 'execute_reply', msg_id)
reply = kc.get_shell_msg(timeout=TIMEOUT)
validate_message(reply, 'execute_reply', msg_id2)
validate_message(reply, 'execute_reply', msg_id2)