Debugging pytest tests causes premature exit upon process.join()
@rchiodo がすでに取り組んでいます。
2026年5月11日 から。
評価
この issue はまだ評価されていません。
説明
Behaviour
Debugging any pytest test that contains code that creates a child process via multiprocessing's mp.Process() and then later waits for that process to terminate via process.join() results in the debugger exiting early.
Specifically, the debugger terminates immediately after the child process terminates. It seems as though the debugger thinks the primary process has terminated, when in fact it's a child process.
Debugging the exact same code but as a standalone python file (i.e. not a test) doesn't cause this issue.
Steps to reproduce:
- Create a pytest file: (e.g. test_debugger.py)
import multiprocessing as mp
import time
def _child_main() -> None:
time.sleep(0.25)
def test_multiprocessing_join_in_test_body() -> None:
proc = mp.Process(
target=_child_main,
name="debug_multiprocessing_test_body_child",
)
proc.daemon = True
proc.start()
print("before!")
proc.join(10)
print("after!")
assert proc.exitcode == 0
- Open the "Testing" tab on the Activity Bar
- Find the test and select "Debug Test"
- The test will exit right after proc.join(10) and be marked as skipped - i.e. it will not print "after!" and will not reach the assert
Diagnostic data
launch.json configuration
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Current File (.venv)",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"cwd": "${workspaceFolder}",
"python": "${workspaceFolder}\\.venv\\Scripts\\python.exe",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false,
"debugAdapterPath": "${workspaceFolder}\\.venv\\Lib\\site-packages\\debugpy\\adapter",
}
]
}
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2026-03-18 13:29:51.064 [info] arg: --rootdir already exists in args, not adding.
2026-03-18 13:29:51.064 [info] Attempting to use temp directory for test ids file, file name: test-ids-00c8f18e91ac982d37c4.txt
2026-03-18 13:29:51.066 [info] Environment variables set for pytest execution: PYTHONPATH=c:\Users\Seb\.vscode\extensions\ms-python.python-2026.4.0-win32-x64\python_files, TEST_RUN_PIPE=\\.\pipe\python-test-results-39db76ade74d9d04d426, RUN_TEST_IDS_PIPE=C:\Users\SEBAST~1\AppData\Local\Temp\test-ids-00c8f18e91ac982d37c4.txt
2026-03-18 13:29:51.066 [info] Running DEBUG pytest with arguments: --rootdir=c:\Users\Seb\Documents\_Repos\test_debug,--capture=no for workspace c:\Users\Seb\Documents\_Repos\test_debug
2026-03-18 13:29:51.067 [info] Using configuration in launch.json
2026-03-18 13:29:59.546 [info] Test Result named pipe \\.\pipe\python-test-results-39db76ade74d9d04d426 cancelled
Output for Python Debugger in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python Debugger)
2026-03-18 13:29:51.452 [info] legacyGetInterpreterDetails: executable='c:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe' resource='c:\Users\Seb\Documents\_Repos\test_debug'
2026-03-18 13:29:51.452 [info] resolveAndUpdatePythonPath - Initial state: pythonPath='undefined', python='c:\Users\Seb\Documents\_Repos\test_debug\.venv\Scripts\python.exe', debugAdapterPython='C:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe', debugLauncherPython='C:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe', workspaceFolder='c:\Users\Seb\Documents\_Repos\test_debug'resolvedInterpreterPath='c:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe'
2026-03-18 13:29:51.487 [info] Resolving launch configuration with substituted variables
2026-03-18 13:29:51.503 [info] createDebugAdapterDescriptor: request='launch' name='Python: Debug Current File (.venv)'
2026-03-18 13:29:51.504 [info] legacyResolveEnvironment: Resolving environment 'C:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe'
2026-03-18 13:29:51.504 [info] legacyResolveEnvironment: Resolved executable='c:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe'
2026-03-18 13:29:51.504 [info] resolveEnvironment: legacy resolved executable='c:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe' version='3.14.2'
2026-03-18 13:29:51.504 [info] getExecutableCommand: executable='c:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe' version='3.14.2'
2026-03-18 13:29:51.505 [info] createDebugAdapterDescriptor: python command parts='c:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe'
2026-03-18 13:29:51.505 [info] DAP Server launched with command: c:\Users\Seb\.pyenv\pyenv-win\versions\3.14.2\python.exe C:\Users\Seb\Documents\_Repos\test_debug\.venv\Lib\site-packages\debugpy\adapter
2026-03-18 13:29:52.180 [info] Received 'debugpySockets' event from debugpy.
2026-03-18 13:29:52.184 [info] Received 'debugpySockets' event from debugpy.
2026-03-18 13:29:52.186 [info] Received 'debugpySockets' event from debugpy.
2026-03-18 13:29:54.283 [info] Received 'debugpySockets' event from debugpy.
2026-03-18 13:29:58.802 [info] Resolving attach configuration with substituted variables
2026-03-18 13:29:58.802 [info] Using the only workspaceFolder found: c:\Users\Seb\Documents\_Repos\test_debug
2026-03-18 13:29:58.808 [info] createDebugAdapterDescriptor: request='attach' name='Subprocess 34584'
2026-03-18 13:29:58.808 [info] Connecting to DAP Server at: 127.0.0.1:63314
2026-03-18 13:29:58.814 [info] Received 'debugpySockets' event from debugpy.
2026-03-18 13:29:59.571 [info] Received 'debugpySockets' event from debugpy.
2026-03-18 13:29:59.596 [info] Received 'debugpySockets' event from debugpy.
debugpy.pydevd.34568.log
debugpy.adapter-19128.log
debugpy.pydevd.31448.log
debugpy.launcher-23484.log
debugpy.server-34568.log
debugger.vscode_5969cc3c-fa33-4f22-b0cd-4285a0e2cfe7.log
debugger.vscode_d64cf1b2-b9f0-47bf-9e42-418f78572c05.log
- 主要言語
- TypeScript
- スター
- 181
- フォーク
- 126
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/vscode-python-debugger のほかの issue
-
triage-needed
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/vscode-python-debugger#1110 ·
-
triage-needed
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
microsoft/vscode-python-debugger#1024 · コメント 1 件 ·
-
triage-needed
microsoft/vscode-python-debugger#1111 · リアクション 1 件 · 担当者 1 名 ·
-
triage-needed
microsoft/vscode-python-debugger#1106 · リアクション 1 件 · 担当者 2 名 ·
-
triage-needed
microsoft/vscode-python-debugger#1104 · リアクション 1 件 · 担当者 1 名 ·
microsoft/vscode-python-debugger の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
usability
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
inmanta/web-console#7367 ·