VS Code unable to find pytest tests on M1 Mac

Viewed 270

I have an M1 Mac and am running VS Code with the latest version of the Python extension installed. I have set up a new virtual environment for a specific project, which has an extensive set of pytest tests to run. I have enable pytest tests in VS Code, but it returns "Error discovering pytest tests" in the Testing pane.

It instructs me to "see Output > Python" for details, and here I find the following:

> ./venv/bin/python ~/.vscode/extensions/ms-python.python-2022.0.1814523869/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear .
cwd: .
[ERROR 2022-2-2 22:11:27.708]: Error discovering pytest tests:
 [SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at a.runTestDiscovery (/Users/xxx/.vscode/extensions/ms-python.python-2022.0.1814523869/out/client/extension.js:85:82555)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 0)
    at async E.refreshTestData (/Users/xxx/.vscode/extensions/ms-python.python-2022.0.1814523869/out/client/extension.js:85:94153)
    at async v.refreshTestDataInternal (/Users/xxx/.vscode/extensions/ms-python.python-2022.0.1814523869/out/client/extension.js:85:85547)
    at async Promise.all (index 0)
    at async v.refreshTestDataInternal (/Users/xxx/.vscode/extensions/ms-python.python-2022.0.1814523869/out/client/extension.js:85:86200)] {
  stdout: ''
}

When I run the command in my terminal, I get a segmentation fault:

zsh: segmentation fault  ./venv/bin/python  discover pytest -- --rootdir . -s --cache-clear .

I've searched for a solution for this but have yet to find anything that works. Has anyone ever had the same problem? And ideally been able to fix it?

0 Answers
Related