Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Pytest times out in debug mode with Pycharm 2023.2.1

Đang mở
#152 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
testing-qa

Hướng nghiên cứu

Tái hiện timeout với PyCharm 2023.2.1 bằng cách sử dụng tests/unittests/utils/test_banned_passwords.py::test_is_password_banned và cấu hình timeout pytest được báo cáo. So sánh hành vi ở chế độ debug với các phiên bản PyCharm cũ hơn; hoàn tất khi test không còn bị timeout ở chế độ debug, trong khi timeout đã cấu hình vẫn được áp dụng trong các lần chạy thông thường.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
258
Fork
69
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pytest-dev/pytest-timeout

Tất cả issue của pytest-dev/pytest-timeout

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.