6.15.2: pytest is failing in `ipykernel/tests/test_debugger.py::test_stop_on_breakpoint` unit

Open
#981 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
testing-qa

Research direction

Start with ipykernel/tests/test_debugger.py::test_stop_on_breakpoint and reproduce it using the reported PEP517 --no-isolation build, installed wheel, and pytest environment. Investigate why the dumpCell response lacks the expected body and sourcePath, then run the focused test and the full pytest suite to confirm the failure is resolved.

Written by the indexing model from the issue text.

Description

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-ipykernel-6.15.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-ipykernel-6.15.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/ipykernel-6.15.2, configfile: pyproject.toml, testpaths: ipykernel/tests, ipykernel/inprocess/tests
plugins: timeout-2.1.0, flaky-3.7.0
timeout: 300.0s
timeout method: signal
timeout func_only: False
collected 116 items

ipykernel/tests/test_async.py ..ss                                                                                                                                   [  3%]
ipykernel/tests/test_connect.py .....                                                                                                                                [  7%]
ipykernel/tests/test_debugger.py ...F....                                                                                                                            [ 14%]
ipykernel/tests/test_embed_kernel.py ...                                                                                                                             [ 17%]
ipykernel/tests/test_eventloop.py .                                                                                                                                  [ 18%]
ipykernel/tests/test_heartbeat.py ....                                                                                                                               [ 21%]
ipykernel/tests/test_io.py ..                                                                                                                                        [ 23%]
ipykernel/tests/test_jsonutil.py sssss                                                                                                                               [ 27%]
ipykernel/tests/test_kernel.py .ss..........s..s......                                                                                                               [ 47%]
ipykernel/tests/test_kernelspec.py .............                                                                                                                     [ 58%]
ipykernel/tests/test_message_spec.py .......................                                                                                                         [ 78%]
ipykernel/tests/test_pickleutil.py .....                                                                                                                             [ 82%]
ipykernel/tests/test_start_kernel.py ..                                                                                                                              [ 84%]
ipykernel/tests/test_zmq_shell.py ......                                                                                                                             [ 89%]
ipykernel/inprocess/tests/test_kernel.py s......                                                                                                                     [ 95%]
ipykernel/inprocess/tests/test_kernelmanager.py .....                                                                                                                [100%]

================================================================================= FAILURES =================================================================================
_________________________________________________________________________ test_stop_on_breakpoint __________________________________________________________________________

kernel_with_debug = <jupyter_client.blocking.client.BlockingKernelClient object at 0x7f886e532eb0>

    def test_stop_on_breakpoint(kernel_with_debug):
        code = """def f(a, b):
        c = a + b
        return c

    f(2, 3)"""

        r = wait_for_debug_request(kernel_with_debug, "dumpCell", {"code": code})
>       source = r["body"]["sourcePath"]
E       KeyError: 'body'

ipykernel/tests/test_debugger.py:138: KeyError
===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===
=========================================================================== slowest 10 durations ===========================================================================
31.37s call     ipykernel/tests/test_kernel.py::test_shutdown_subprocesses
6.32s call     ipykernel/tests/test_async.py::test_async_interrupt[asyncio]
3.09s call     ipykernel/tests/test_kernel.py::test_control_thread_priority
2.96s call     ipykernel/tests/test_kernel.py::test_interrupt_during_input
2.82s call     ipykernel/tests/test_kernel.py::test_subprocess_print
2.81s call     ipykernel/tests/test_kernel.py::test_interrupt_with_message
2.53s call     ipykernel/tests/test_message_spec.py::test_execute_stop_on_error
2.29s call     ipykernel/tests/test_embed_kernel.py::test_embed_kernel_reentrant
2.03s call     ipykernel/tests/test_kernel.py::test_interrupt_during_pdb_set_trace
1.78s setup    ipykernel/tests/test_debugger.py::test_stop_on_breakpoint
========================================================================= short test summary info ==========================================================================
SKIPPED [1] ipykernel/tests/test_async.py:34: Requires trio
SKIPPED [1] ipykernel/tests/test_async.py:34: Requires curio
SKIPPED [1] ipykernel/tests/test_jsonutil.py:36: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:71: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:98: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:104: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_jsonutil.py:115: json_clean is a no-op
SKIPPED [1] ipykernel/tests/test_kernel.py:61: Currently don't capture during test as pytest does its own capturing
SKIPPED [1] ipykernel/tests/test_kernel.py:73: Currently don't capture during test as pytest does its own capturing
SKIPPED [1] ipykernel/tests/test_kernel.py:290: only run on Windows
SKIPPED [1] ipykernel/tests/test_kernel.py:349: test only on windows
SKIPPED [1] ipykernel/inprocess/tests/test_kernel.py:129: Currently don't capture during test as pytest does its own capturing
FAILED ipykernel/tests/test_debugger.py::test_stop_on_breakpoint - KeyError: 'body'
========================================================== 1 failed, 103 passed, 12 skipped in 103.54s (0:01:43) ===========================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- -----------------
alabaster                     0.7.12
asttokens                     2.0.5
attrs                         22.1.0
Babel                         2.10.2
backcall                      0.2.0
Brlapi                        0.8.3
build                         0.8.0
charset-normalizer            2.1.0
codespell                     2.1.0
cycler                        0.11.0
debugpy                       1.6.3
decorator                     5.1.1
distro                        1.7.0
docutils                      0.18.1
editables                     0.3
entrypoints                   0.4
executing                     0.8.3
extras                        1.0.0
fixtures                      4.0.0
flaky                         3.7.0
fonttools                     4.37.1
gpg                           1.17.1-unknown
hatchling                     1.8.1
idna                          3.3
imagesize                     1.4.1
importlib-metadata            4.12.0
iniconfig                     1.1.1
ipykernel                     6.15.1
ipyparallel                   8.4.1
ipython                       8.4.0
jedi                          0.18.1
Jinja2                        3.1.1
jupyter_client                7.3.5
jupyter_core                  4.11.1
kiwisolver                    1.4.4
libcomps                      0.1.18
louis                         3.22.0
markdown-it-py                2.1.0
MarkupSafe                    2.1.1
matplotlib                    3.5.3
matplotlib-inline             0.1.5
mdit-py-plugins               0.3.0
mdurl                         0.1.1
myst-parser                   0.18.0
nest-asyncio                  1.5.5
numpy                         1.23.1
olefile                       0.46
packaging                     21.3
parso                         0.8.3
pathspec                      0.9.0
pbr                           5.9.0
pep517                        0.12.0
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.2.0
pip                           22.2.1
pluggy                        1.0.0
prompt-toolkit                3.0.29
psutil                        5.9.0
ptyprocess                    0.7.0
pure-eval                     0.2.2
py                            1.11.0
Pygments                      2.13.0
PyGObject                     3.42.2
pyparsing                     3.0.9
pytest                        7.1.2
pytest-timeout                2.1.0
python-dateutil               2.8.2
pytz                          2022.1
PyYAML                        6.0
pyzmq                         23.2.0
requests                      2.28.1
rpm                           4.17.0
setuptools                    65.3.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        5.1.1
sphinxcontrib-applehelp       1.0.2.dev20220730
sphinxcontrib-devhelp         1.0.2.dev20220730
sphinxcontrib_github_alt      1.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20220730
sphinxcontrib-qthelp          1.0.3.dev20220730
sphinxcontrib-serializinghtml 1.1.5
stack-data                    0.5.0
testtools                     2.5.0
tomli                         2.0.1
tornado                       6.2
tqdm                          4.64.0
traitlets                     5.3.0
typing_extensions             4.2.0
urllib3                       1.26.12
wcwidth                       0.2.5
wheel                         0.37.1
zipp                          3.8.1
Dominant language
Python
Stars
734
Forks
411
Avg merge
1d 2h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ipython/ipykernel

All issues in ipython/ipykernel

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.