Error when running tests: Cannot read property 'testsuites' of null
See original GitHub issueEnvironment data
- VS Code version: 1.49.2 (user setup)
- Extension version (available under the Extensions sidebar): v2020.9.111407
- OS and version: Windows_NT x64 10.0.18363
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.9 64-bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Relevant/affected Python packages and their versions: pytest==6.0.2
- Value of the
python.languageServer
setting: Pylance
Expected behaviour
Test are run after >Python: Run All Tests command
Actual behaviour
There is an error when running the tests. Command ‘Python: Run All Tests’ resulted in an error (Cannot read property ‘testsuites’ of null) Output: c:\Users\Vaust XIII\AppData\Local\Programs\Python\Python37\python.exe: can’t open file ‘“c:/Users/Vaust XIII/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py”’: [Errno 22] Invalid argument Error: TypeError: Cannot read property ‘testsuites’ of null
Steps to reproduce:
Test have been running fine, then I added a new one and started getting this error. I tried deleting the new test, but it didn’t help, the error is still there
hello.py
def hello():
return "Hello"
hello_test.py
from hello import *
def test_hello():
assert hello() == "Hello"
Additional info
The >Python: Debug All Tests command works fine. Tests are run, I can debug them, message “x passed in y” is printed to Debug Console
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
> ~\AppData\Local\Programs\Python\Python37\python.exe "c:/Users/Vaust XIII/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py" pytest --override-ini junit_family=xunit1 --rootdir e:\python\foo --junit-xml=C:\Users\VAUSTX~1\AppData\Local\Temp\tmp-2288ORjzo6SAoZsg.xml .
cwd: e:\python\foo
> ~\AppData\Local\Programs\Python\Python37\python.exe "c:/Users/Vaust XIII/.vscode/extensions/ms-python.python-2020.9.111407/pythonFiles/pyvsc-run-isolated.py" pytest --override-ini junit_family=xunit1 --rootdir e:\python\foo --junit-xml=C:\Users\VAUSTX~1\AppData\Local\Temp\tmp-2288ORjzo6SAoZsg.xml .
cwd: e:\python\foo
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (3 by maintainers)
Top GitHub Comments
I have an
__init__.py
in my tests folder and I am still getting this issue. Downgraded to2020.9.114305
per https://github.com/microsoft/vscode-python/issues/14579 and still had the issue.At this point I have given up and I am just running my tests using
pytest
in the Terminal :pAdding an
__init__.py
file inside my tests folder is solving the issue for me currently on Version: 1.52.1 for MacOS -> https://github.com/microsoft/vscode-python/issues/14579#issuecomment-725837711