ipykernel
ipykernel copied to clipboard
6.5.1: pytest is failing in one unit (only)
I'm trying to package your module as an rpm package. So I'm using the typical build, install and test cycle used on building packages from non-root account.
- "setup.py build"
- "setup.py install --root </install/prefix>"
- "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Looks like after some changes in ipykernel only one unit is now failing:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-ipykernel-6.5.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-ipykernel-6.5.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
rootdir: /home/tkloczko/rpmbuild/BUILD/ipykernel-6.5.1
plugins: shutil-1.7.0, virtualenv-1.7.0, mock-3.6.1, hypothesis-6.14.6, cov-2.12.1, asyncio-0.15.1, anyio-3.3.4, forked-1.3.0, xdist-2.3.0, flaky-3.7.0
collected 105 items / 1 skipped / 104 selected
ipykernel/inprocess/tests/test_kernel.py s.s.. [ 4%]
ipykernel/inprocess/tests/test_kernelmanager.py ..... [ 9%]
ipykernel/tests/test_async.py ...s [ 13%]
ipykernel/tests/test_connect.py ..... [ 18%]
ipykernel/tests/test_embed_kernel.py ... [ 20%]
ipykernel/tests/test_eventloop.py . [ 21%]
ipykernel/tests/test_heartbeat.py .... [ 25%]
ipykernel/tests/test_io.py .. [ 27%]
ipykernel/tests/test_jsonutil.py sssss [ 32%]
ipykernel/tests/test_kernel.py .ss........F.ss.s..... [ 53%]
ipykernel/tests/test_kernelspec.py ............. [ 65%]
ipykernel/tests/test_message_spec.py ....................... [ 87%]
ipykernel/tests/test_pickleutil.py ..... [ 92%]
ipykernel/tests/test_start_kernel.py .. [ 94%]
ipykernel/tests/test_zmq_shell.py ...... [100%]
================================================================================= FAILURES =================================================================================
_____________________________________________________________________________ test_help_output _____________________________________________________________________________
def test_help_output():
"""ipython kernel --help-all works"""
> tt.help_all_output_test('kernel')
ipykernel/tests/test_kernel.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
subcommand = 'kernel'
def help_all_output_test(subcommand=''):
"""test that `ipython [subcommand] --help-all` works"""
cmd = get_ipython_cmd() + [subcommand, '--help-all']
out, err, rc = get_output_error_code(cmd)
> nt.assert_equal(rc, 0, err)
E NameError: name 'nt' is not defined
/usr/lib/python3.8/site-packages/IPython/testing/tools.py:466: NameError
============================================================================= warnings summary =============================================================================
ipykernel/tests/test_pickleutil.py:4
/home/tkloczko/rpmbuild/BUILD/ipykernel-6.5.1/ipykernel/tests/test_pickleutil.py:4: DeprecationWarning: ipykernel.pickleutil is deprecated. It has moved to ipyparallel.
from ipykernel.pickleutil import can, uncan
ipykernel/inprocess/tests/test_kernel.py::InProcessKernelTestCase::test_getpass_stream
/home/tkloczko/rpmbuild/BUILD/ipykernel-6.5.1/ipykernel/inprocess/tests/test_kernel.py:126: UserWarning: The `stream` parameter of `getpass.getpass` will have no effect when using ipykernel
kernel.getpass(stream='non empty')
ipykernel/tests/test_message_spec.py::test_execute
/home/tkloczko/rpmbuild/BUILD/ipykernel-6.5.1/ipykernel/tests/test_message_spec.py:99: DeprecationWarning: ExecuteResult._data_changed is deprecated in traitlets 4.1: use @observe and @unobserve instead.
def _data_changed(self, name, old, new):
-- Docs: https://docs.pytest.org/en/stable/warnings.html
===Flaky Test Report===
test_embed_kernel_basic passed 1 out of the required 1 times. Success!
test_embed_kernel_namespace passed 1 out of the required 1 times. Success!
test_embed_kernel_reentrant passed 1 out of the required 1 times. Success!
test_subprocess_print passed 1 out of the required 1 times. Success!
test_subprocess_noprint passed 1 out of the required 1 times. Success!
test_subprocess_error passed 1 out of the required 1 times. Success!
test_ipython_start_kernel_userns passed 1 out of the required 1 times. Success!
test_ipython_start_kernel_no_userns passed 1 out of the required 1 times. Success!
===End Flaky Test Report===
========================================================================= short test summary info ==========================================================================
SKIPPED [1] ipykernel/tests/test_debugger.py:8: could not import 'debugpy': No module named 'debugpy'
SKIPPED [1] ipykernel/inprocess/tests/test_kernel.py:102: Currently don't capture during test as pytest does its own capturing
SKIPPED [1] ipykernel/inprocess/tests/test_kernel.py:65: This test requires matplotlib
SKIPPED [1] ipykernel/tests/test_async.py:48: Requires curio
SKIPPED [1] ipykernel/tests/test_jsonutil.py:35: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:69: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:95: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:101: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:111: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_kernel.py:53: Currently don't capture during test as pytest does its own capturing
SKIPPED [1] ipykernel/tests/test_kernel.py:67: Currently don't capture during test as pytest does its own capturing
SKIPPED [1] ipykernel/tests/test_kernel.py:272: only run on Windows
SKIPPED [1] ipykernel/tests/test_kernel.py:300: this test requires matplotlib
SKIPPED [1] ipykernel/tests/test_kernel.py:334: test only on windows
FAILED ipykernel/tests/test_kernel.py::test_help_output - NameError: name 'nt' is not defined
===================================================== 1 failed, 91 passed, 14 skipped, 3 warnings in 60.19s (0:01:00) ======================================================
Hi @kloczek, we have nose as a test dependency.
Ha .. so it could be that my patch replacing nose by pytest is mesing.
--- a/ipykernel/tests/utils.py~ 2021-08-30 12:47:58.000000000 +0100
+++ b/ipykernel/tests/utils.py 2021-08-30 21:10:43.794189532 +0100
@@ -11,7 +11,7 @@
from queue import Empty
from subprocess import STDOUT
-import nose
+import pytest
from jupyter_client import manager
@@ -30,7 +30,7 @@
"""
kwargs['stderr'] = STDOUT
try:
- kwargs['stdout'] = nose.iptest_stdstreams_fileno()
+ kwargs['stdout'] = pytest.iptest_stdstreams_fileno()
except AttributeError:
pass
return manager.start_new_kernel(startup_timeout=STARTUP_TIMEOUT, **kwargs)
@@ -143,7 +143,7 @@
"""
kwargs = {'stderr': STDOUT}
try:
- kwargs['stdout'] = nose.iptest_stdstreams_fileno()
+ kwargs['stdout'] = pytest.iptest_stdstreams_fileno()
except AttributeError:
pass
if argv is not None:
nose should not be used with python 3.x
https://nose.readthedocs.io/en/latest/
Ha .. so it could be that my patch replacing
nosebypytestis mesing.--- a/ipykernel/tests/utils.py~ 2021-08-30 12:47:58.000000000 +0100 +++ b/ipykernel/tests/utils.py 2021-08-30 21:10:43.794189532 +0100 @@ -11,7 +11,7 @@ from queue import Empty from subprocess import STDOUT -import nose +import pytest from jupyter_client import manager @@ -30,7 +30,7 @@ """ kwargs['stderr'] = STDOUT try: - kwargs['stdout'] = nose.iptest_stdstreams_fileno() + kwargs['stdout'] = pytest.iptest_stdstreams_fileno() except AttributeError: pass return manager.start_new_kernel(startup_timeout=STARTUP_TIMEOUT, **kwargs) @@ -143,7 +143,7 @@ """ kwargs = {'stderr': STDOUT} try: - kwargs['stdout'] = nose.iptest_stdstreams_fileno() + kwargs['stdout'] = pytest.iptest_stdstreams_fileno() except AttributeError: pass if argv is not None:
That patch should break IPython tests.
noseshould not be used with python 3.x nose.readthedocs.io/en/latest
nose should not be used because it's abandonware, but it was working fine with Python 3.x.
6.6.0 removed nose requirement: https://github.com/ipython/ipykernel/blob/2725b4a00777708e6838f1d44ac95fb2fb49306b/CHANGELOG.md#L23