/usr/lib/python3/dist-packages/ipykernel/tests/test_eventloop.py is in python3-ipykernel 4.8.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | """Test eventloop integration"""
import sys
import time
import IPython.testing.decorators as dec
from .utils import flush_channels, start_new_kernel, execute
KC = KM = None
def setup():
"""start the global kernel (if it isn't running) and return its client"""
global KM, KC
KM, KC = start_new_kernel()
flush_channels(KC)
def teardown():
KC.stop_channels()
KM.shutdown_kernel(now=True)
async_code = """
from ipykernel.tests._asyncio import async_func
async_func()
"""
@dec.skipif(sys.version_info < (3, 5), "async/await syntax required")
def test_asyncio_interrupt():
flush_channels(KC)
msg_id, content = execute('%gui asyncio', KC)
assert content['status'] == 'ok', content
flush_channels(KC)
msg_id, content = execute(async_code, KC)
assert content['status'] == 'ok', content
KM.interrupt_kernel()
flush_channels(KC)
msg_id, content = execute(async_code, KC)
assert content['status'] == 'ok'
|