No code lenses shown for pytest
See original GitHub issueVisual Studio Code - Insiders: 1.36.0-insider python-insider: 2019.6.21464-rc
Repro steps:
- Input below code:
def test_passing():
assert 42 == 42
def test_failure():
assert 42 == -13
- Run tests with pytest framework
- Run all tests
Actual Result: No code lenses shown after run all tests
Expect Result: It should display code lenses
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Environment Data - Stack Overflow
Typically the code lenses for tests fail because either another extension interferes (e.g. gitlens) or the code isn't being picked up by ...
Read more >11 Best VS Code extensions for Python (2022)
This list contains the 10 best VS Code extensions for Python including Pylance, Sourcery, Python by Microsoft, and more.
Read more >How and why I use pytest's xfail - Paul Ganssle
Although I was initially skeptical, several years ago I was convinced that xfail is a quite useful tool for managing an evolving codebase....
Read more >Python Test Explorer (Django Hacked) - Visual Studio Marketplace
Extension for Visual Studio Code - Run your Django unittest tests in the Sidebar of ... As of now, there are no way...
Read more >pytest vs Lens comparison of testing frameworks - Knapsack Pro
Lens is a unit-testing framework for PHP that needs no assertions ... Client-side. Allows testing code execution on the client, such as a...
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 FreeTop 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
Top GitHub Comments
I’ve resolved this issue (codelens is visible now) by renaming first letter of the first dir in the workspace path to lowercase. It was sole uppercase letter in the path. But it was uppercase all its lifetime and I had no problems with codelens and debug. Don’t forget to remove cache folders (
.pytest_cache
,__pycache__
).Is it relevant to Microsoft/vscode#12448?
FWIW, the adapter effectively [1] returns whatever pytest gives it. We have no guarantees about casing or even that the returned root and test source will be in the workspace. So we should always match carefully, as much as possible. What pytest provides will almost always be okay, but the mitigation is worth doing anyway (not big nor complicated).
[1] Currently we normcase but the situation remains either way.