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

未关闭
#981 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
testing-qa

调研方向

从 ipykernel/tests/test_debugger.py::test_stop_on_breakpoint 开始,使用报告中的 PEP517 --no-isolation 构建、已安装的 wheel 和 pytest 环境重现它。调查 dumpCell 响应为何缺少预期的 body 和 sourcePath,然后运行聚焦测试和完整的 pytest 测试套件,以确认该失败已解决。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Python
星标
734
派生
411
平均合并
1 天 2 小时
30 天内合并 PR
9

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ipython/ipykernel 的其他 Issue

查看 ipython/ipykernel 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。