pytest discovery seems to fail in Python 3.8
See original GitHub issueEnvironment data
- VS Code version: 1.4.10-insiders
- Extension version (available under the Extensions sidebar): 2019.12.51221-dev
- OS and version: macOS 10.15.1
- Python version (& distribution if applicable, e.g. Anaconda): 3.8.0
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): pyenv
- Relevant/affected Python packages and their versions: pytest 5.3.1
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): Language Server
Expected behaviour
Discovery tests works fine.
Actual behaviour
Discovery tests fails with error
SyntaxError: Unexpected token in JSON at position 0"
Steps to reproduce:
I think this occurs only in Python 3.8 (the same code, in Python 3.7 works fine). The cause may be because in Python 3.8 pytests returns a the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
warning. Not sure if that may be crashing the parsing of the output.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
VSCode pytest test discovery fails - python - Stack Overflow
It seems that when testing is universally enabled for all python projects and it fails to discover tests at the beginning, it fails...
Read more >Changelog — pytest documentation
Fixes a crash during a failed teardown in unittest TestCases with non-default __init__ . Regressed in pytest 7.0.0. #9636: The pythonpath plugin was...
Read more >Why is test discovery failing? : r/vscode - Reddit
Python version is 3.8.5, I am using the Python extension from the repo ... My code seems to be correct (pytest works from...
Read more >pytest Documentation - Read the Docs
pytest discovers all tests following its Conventions for Python test discovery, so it finds both test_ prefixed functions.
Read more >doctest — Test interactive Python examples — Python 3.11.1 ...
This won't display anything unless an example fails, in which case the failing ... output as appeared in the initial '>>> ' line...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can.
Glad to help!