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.

Code lens not present overtop test code when using PyTest >= 3.7

See original GitHub issue

It is not possible to run/debug single tests from vscode if the project is using pytest version 3.7.0 or 3.7.1. Pytest 3.6.4 can run and discover tests without issues.

Environment data

  • VS Code version: 1.25.1
  • Extension version (available under the Extensions sidebar): 2018.7.1
  • OS and version: Linux Debian GNU/Linux 9 (stretch)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): pyenv
  • Relevant/affected Python packages and their versions: pytest 3.7.0, 3.7.1

Actual behavior

Python: Discover Unit Test does not annotate any test cases with the Run Test | Debug Test annotation. Python: Run Unit Test Method results in “No tests ran…”

If I downgrade pytest to 3.6.4 vs code does not have these issues.

Expected behavior

Python: Discover Unit Test should annotate any test cases with the Run Test | Debug Test annotation. It should be possible to run/debug single tests.

Steps to reproduce:

  1. Setup a project with pytest 3.7.0
  2. Issue the command Python: Run Unit Test Method

Logs

========================= no tests ran in 0.29 seconds ========================= ============================= test session starts ============================== platform linux – Python 3.6.5, pytest-3.7.1, py-1.5.4, pluggy-0.7.1 rootdir: /home/martinwa/wd/platformci/reactor/src, inifile: plugins: tmpelasticsearch-0.1.2, pylint-0.11.0, flake8-1.0.1, datadir-ng-1.1.0, cov-2.5.1

-------------- generated xml file: /tmp/tmp-19448low3Z4aSmvDT.xml -------------- ========================= no tests ran in 0.00 seconds ========================= ERROR: file not found: test_api_utils.py::test_add_state_filter_noq_0states

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
DonJayamannecommented, Aug 7, 2018

@brettcannon should we increase the priority of this issue?

4reactions
jd-naranjocommented, Aug 7, 2018

I would like to confirm that today I was experiencing the exact same issue, I couldn’t debug single tests. I reverted my venv to pytest 3.6.4 and it works. It would be great to make VS Code compatible with the latest versions of pytest. @MartinWallgren thanks for the detailed description of the issue, at least I realized I was not missing something with the VS Code settings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code not finding pytest tests - python - Stack Overflow
Re-open Visual Studio Code and choose: File > Open Folder (re-open the folder that contains your project/test files).
Read more >
CodeLens Not Appearing Above Methods (Visual Studio 2019)
I am using VS 2019 Enterprise. I have the same behavior. Code Lens is missing for types where it used to be present....
Read more >
PLENOPTIC IMAGING AND VISION USING ANGLE ...
In this thesis, we present multimodal plenoptic imaging, the simultaenous capture of multiple plenoptic dimensions, using Angle Sensitive Pixels (ASP), ...
Read more >
Sensemaking
Instead, users should be created using exactly the same code, so as to keep the code maintainable, not introduce bugs, and not require...
Read more >
Untitled
ObjectSense takes less than 5000 lines of code for the core of the language ... r\n* Run pytest\/nosetests for the project or test...
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