-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pytest exits with null code and SIGSEGV #22776
Comments
Problem is in my setup sorry |
No worries! Happy coding! (If you do have a moment to comment the fix other users who run into the same setup issue could reference this for help) |
I managed to understand where the problem is coming from but haven't found a proper solution yet. TL;DRThe workspace error is caused by the My guess is that the paths are not correctly set for the tests discovery. (Sorry for the long post) DescriptionIf I run the discovery manually via Click me``` >> hatch run test:discover cmd [1] | pytest --collect-only ========================================================= test session starts ========================================================= platform darwin -- Python 3.12.0, pytest-7.4.4, pluggy-1.4.0 cachedir: .caches/pytest rootdir: /Users/USER/Desktop/hatchmwe configfile: pyproject.toml testpaths: tests plugins: xdist-3.5.0 collected 1 item
Whereas in my testing tab, I have the pytest discovery error if I try to refresh tests and I have the following in the python output: Click me``` 2024-01-25 21:16:50.177 [info] Running discovery for pytest using the new test adapter. 2024-01-25 21:16:50.177 [info] All environment variables set for pytest discovery for workspace /Users/USER/Desktop/hatchmwe: {"COMMAND_MODE":"unix2003","HOME":"/Users/USER","LOGNAME":"USER","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PWD":"/","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.DuUnRoJfbQ/Listeners","TMPDIR":"/var/folders/mc/81l0rqld58q52s3gbgrrz1780000gn/T/","USER":"USER","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/USER/Library/Application Support/Code/CachedData/8b3775030ed1a69b13e4f4c628c612102e30a681","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/USER/Library/Application Support/Code/1.85-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-gb\",\"osLocale\":\"en-gb\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"50854","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.90466387.90466393","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x2","ELECTRON_RUN_AS_NODE":"1","VSCODE_L10N_BUNDLE_LOCATION":"","PATH":"/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Pololu USB AVR Programmer v2.app/Contents/MacOS","PYTHONPATH":"/Users/USER/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles","TEST_UUID":"c87431cf-1477-4b03-904d-1bb316c91fe0","TEST_PORT":"60259"}
Additionally when I run a test via the Run Test button, the test runs fine (everything is correct in the TEST RESULTS tab) but the workspace crashes and the test is marked as successful for 0.3s and then as failed. Click me``` 2024-01-25 21:38:17.261 [info] Server listening on port 64415 2024-01-25 21:38:17.269 [info] All environment variables set for pytest execution in /Users/USER/Desktop/hatchmwe workspace: {"COMMAND_MODE":"unix2003","HOME":"/Users/USER","LOGNAME":"USER","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PWD":"/","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.DuUnRoJfbQ/Listeners","TMPDIR":"/var/folders/mc/81l0rqld58q52s3gbgrrz1780000gn/T/","USER":"USER","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/USER/Library/Application Support/Code/CachedData/8b3775030ed1a69b13e4f4c628c612102e30a681","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/USER/Library/Application Support/Code/1.85-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-gb\",\"osLocale\":\"en-gb\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"50854","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.90466387.90466393","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x2","ELECTRON_RUN_AS_NODE":"1","VSCODE_L10N_BUNDLE_LOCATION":"","PATH":"/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Pololu USB AVR Programmer v2.app/Contents/MacOS","PYTHONPATH":"/Users/USER/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles","TEST_UUID":"c8c2ca16-f001-4223-a31f-837f09e93479","TEST_PORT":"60259","RUN_TEST_IDS_PORT":"64415"} 2024-01-25 21:38:17.269 [info] Running pytest with arguments: /Users/USER/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/vscode_pytest/run_pytest_script.py --rootdir /Users/USER/Desktop/hatchmwe for workspace /Users/USER/Desktop/hatchmwe
Finally when I run the same test via the Debug Test button, the test runs successfully, the workspace is fine and the test is marked as successful. Minimal working exampleHere is the full setup of my MWE. It relies on hatch and wxpython. Please create the environments by running these commands before testing:
Content of ./.vscode/settings.json Click me``` { "python.analysis.extraPaths": [ ".venvs/default/lib/python3.12/site-packages", ], "python.defaultInterpreterPath": "${workspaceFolder}/.venvs/test/", "python.languageServer": "Pylance", "python.terminal.activateEnvInCurrentTerminal": false, "python.terminal.activateEnvironment": false, "python.testing.pytestEnabled": true, "python.testing.pytestPath": "${workspaceFolder}/.venvs/test/bin/pytest", "python.testing.unittestEnabled": false, "testing.defaultGutterClickAction": "debug", } ```Content of ./pyproject.toml Click me``` [build-system] requires = ["hatchling"] build-backend = "hatchling.build"
Content of ./src/hatchdemo/init.py Click me``` import typing
Content of ./tests/init.py Click me``` # empty ```Content of ./tests/test_GUI.py Click me
PROBLEMI can get it to work if I move the My guess is that the paths are not correctly set for the tests discovery. What is your opinion? A solution? |
if you do |
OK just got to the bottom of it. It is a known problem with wxPython on python 3.12.0. Solution is to accept it or use another version of python :) Thanks |
Type: Bug
Behaviour
Expected vs. Actual
Expected: The extension to be able to detect tests when pytest test discovery succeeds.
Actual: Running
./.venvs/bin/python -m pytest --collect-only
works perfectly. Refresh the tests from the button works but I have an error message in the python log and there the "pytest Discovery Error" banner in the testing tab. I can run the test with debugging and it detects as successful. When I run the test without debugging, it detects it as failed with the[error] Subprocess exited unsuccessfully with exit code null and signal SIGSEGV on workspace ...
error messageSteps to reproduce:
Diagnostic data
python.languageServer
setting: PylanceOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.22.1
VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:32.531Z)
OS version: Darwin x64 21.6.0
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
The text was updated successfully, but these errors were encountered: