question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest discovery seems to fail in Python 3.8

See original GitHub issue

Environment 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:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
brettcannoncommented, Nov 29, 2019

Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can.

0reactions
ericsnowcurrentlycommented, Dec 11, 2019

Glad to help!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found