Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Pytest times out in debug mode with Pycharm 2023.2.1

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
testing-qa

调研方向

使用tests/unittests/utils/test_banned_passwords.py::test_is_password_banned和报告的pytest超时配置,在PyCharm 2023.2.1中复现超时。将调试模式下的行为与较旧的PyCharm版本进行比较;当测试在调试模式下不再超时,同时配置的超时在正常运行期间仍然生效时,即完成。

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

描述

I am getting the timeout error below when running a test in debug mode with pytest under Pycharm 2023.2.1.
This timeout depends on the timeout value pytest is configured with. I am not getting this issue with older versions of Pycharm. So basically, Pycharm does not ignore the timeout in debug mode.

Note: this issue is similar to this one

Connected to pydev debugger (build 232.9559.58)
/Users/williamafonso/Programming/sara/.venv/bin/python3.11 /Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 55298 --file /Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py --target test_banned_passwords.py::test_is_password_banned 
Testing started at 14:34 ...
Launching pytest with arguments test_banned_passwords.py::test_is_password_banned --no-header --no-summary -q in /Users/williamafonso/Programming/sara/tests/unittests/utils

============================= test session starts ==============================
collecting ... collected 1 item

test_banned_passwords.py::test_is_password_banned 
+++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++

~~~~~~~~~~~~~~~~~~ Stack of pydevd.CommandThread (6153744384) ~~~~~~~~~~~~~~~~~~
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 995, in _bootstrap
    self._bootstrap_inner()
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 219, in run
    self._on_run()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 150, in _on_run
    self._py_db_command_thread_event.wait(0.3)
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 622, in wait
    signaled = self._cond.wait(timeout)
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 324, in wait
    gotit = waiter.acquire(True, timeout)

~~~~~~~~~~~~~~~~~~~~~ Stack of pydevd.Reader (6136918016) ~~~~~~~~~~~~~~~~~~~~~~
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 995, in _bootstrap
    self._bootstrap_inner()
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 219, in run
    self._on_run()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 293, in _on_run
    r = self.sock.recv(1024)

~~~~~~~~~~~~~~~~~~~~~ Stack of pydevd.Writer (6120091648) ~~~~~~~~~~~~~~~~~~~~~~
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 995, in _bootstrap
    self._bootstrap_inner()
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 219, in run
    self._on_run()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 368, in _on_run
    cmd = self.cmdQueue.get(1, 0.1)
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/queue.py", line 180, in get
    self.not_empty.wait(remaining)
  File "/Users/williamafonso/.pyenv/versions/3.11.3/lib/python3.11/threading.py", line 324, in wait
    gotit = waiter.acquire(True, timeout)

~~~~~~~~~~~~~~~~~~~~~~~ Stack of MainThread (8016781440) ~~~~~~~~~~~~~~~~~~~~~~~
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 2199, in <module>
    main()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 2181, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1493, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1500, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py", line 60, in <module>
    sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/config/__init__.py", line 168, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
    res = hook_impl.function(*args)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/main.py", line 317, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/main.py", line 270, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/main.py", line 324, in _main
    config.hook.pytest_runtestloop(session=session)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
    res = hook_impl.function(*args)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/main.py", line 349, in pytest_runtestloop
    item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
    res = hook_impl.function(*args)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 114, in pytest_runtest_protocol
    runtestprotocol(item, nextitem=nextitem)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 133, in runtestprotocol
    reports.append(call_and_report(item, "call", log))
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 222, in call_and_report
    call = call_runtest_hook(item, when, **kwds)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 261, in call_runtest_hook
    return CallInfo.from_call(
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 341, in from_call
    result: Optional[TResult] = func()
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 262, in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
    res = hook_impl.function(*args)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 169, in pytest_runtest_call
    item.runtest()
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/python.py", line 1792, in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
    res = hook_impl.function(*args)
  File "/Users/williamafonso/Programming/sara/.venv/lib/python3.11/site-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
    result = testfunction(**testargs)
  File "/Users/williamafonso/Programming/sara/tests/unittests/utils/test_banned_passwords.py", line 8, in test_is_password_banned
    banned_passwords = BannedPasswords()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1160, in do_wait_suspend
    self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread)
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1175, in _do_wait_suspend
    time.sleep(0.01)

+++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++

Process finished with exit code 1
主要语言
Python
星标
260
派生
70
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

pytest-dev/pytest-timeout 的其他 Issue

查看 pytest-dev/pytest-timeout 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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