Code lens not present overtop test code when using PyTest >= 3.7
See original GitHub issueIt 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:
- Setup a project with pytest 3.7.0
- 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:
- Created 5 years ago
- Reactions:6
- Comments:15 (3 by maintainers)
Top GitHub Comments
@brettcannon should we increase the priority of this issue?
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.