Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No code lenses shown for pytest #6303

Closed
xiaofeng0123 opened this issue Jun 24, 2019 · 12 comments
Closed

No code lenses shown for pytest #6303

xiaofeng0123 opened this issue Jun 24, 2019 · 12 comments
Assignees

Comments

@xiaofeng0123
Copy link

Visual Studio Code - Insiders: 1.36.0-insider
python-insider: 2019.6.21464-rc

Repro steps:

  1. Input below code:
def test_passing():
    assert 42 == 42
def test_failure():
    assert 42 == -13
  1. Run tests with pytest framework
  2. Run all tests

Actual Result:
No code lenses shown after run all tests
image

Expect Result:
It should display code lenses

@xiaofeng0123 xiaofeng0123 added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jun 24, 2019
@brettcannon
Copy link
Member

I can verify.

@brettcannon brettcannon added the important Issue identified as high-priority label Jun 24, 2019
@luabud
Copy link
Member

luabud commented Jun 24, 2019

CodeLenses are not showing for me with 2019.7.21668-dev. Works fine with 2019.5.18875

VS Code 1.35.1

@DonJayamanne DonJayamanne added P0 regression Bug didn't exist in a previous release and removed important Issue identified as high-priority labels Jun 24, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 24, 2019
@DonJayamanne DonJayamanne added important Issue identified as high-priority area-testing and removed P0 regression Bug didn't exist in a previous release labels Jun 24, 2019
@yozlet
Copy link

yozlet commented Jun 24, 2019

I see pytest code lenses on 2019.7.21619-dev, so must have been a very recent breakage.

@DonJayamanne
Copy link

DonJayamanne commented Jun 24, 2019

I see pytest code lenses on 2019.7.21619-dev, so must have been a very recent breakage.

It works for me too (always).
Hence classifying this as a flaky issue, however one that needs to be looked at (hence the P1), as a majority of the extension devs can replicate this issue.

@brettcannon brettcannon added this to the 2019 - June Sprint 13 milestone Jun 26, 2019
@korn-1c-ru
Copy link

korn-1c-ru commented Jul 2, 2019

Same issue here (no codelens visible). How can I help to investigate it?
It reproduces on 1.34 and 1.35.
Test explorer works well, test discovery works.
"editor.codeLens": true
python 3.7.3 32-bit.
pytest 4.3.1 or 4.6.4 or 5.0.0 (codelens doesn't work with all of them).
OS is Windows 10 Pro 64-bit.

Additionally I have setup.py:

[aliases]
test = pytest

[tool:pytest]
addopts =
    --cov=./tests
    --cov-report=xml
    --cov-report=html:coverage

and next option ignored now (but worked some days ago) and debug doesn't work (due to coverage enabled), deleting setup.py allowing to debug but it's not a solution:

{
    "python.testing.pytestArgs": [
        "--no-cov"
    ]
}

I've switched to Nose and codelens appeared. Codelens disappeared when I switched back to PyTest.

@korn-1c-ru
Copy link

korn-1c-ru commented Jul 2, 2019

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?

@brettcannon
Copy link
Member

@korn-1c-ru thanks for the diagnosis!

@karrtikr karrtikr removed the triage label Jul 4, 2019
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Jul 4, 2019
@karrtikr karrtikr removed the triage-needed Needs assignment to the proper sub-team label Jul 4, 2019
@ericsnowcurrently
Copy link
Member

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.

@brettcannon
Copy link
Member

CTI said they ran into this again.

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 15, 2020
@ericsnowcurrently ericsnowcurrently added triage-needed Needs assignment to the proper sub-team and removed important Issue identified as high-priority labels Jun 15, 2020
@ericsnowcurrently ericsnowcurrently removed triage-needed Needs assignment to the proper sub-team regression Bug didn't exist in a previous release labels Jun 15, 2020
@karrtikr karrtikr removed area-testing windows bug Issue identified by VS Code Team member as probable bug labels Jun 17, 2020
@karrtikr
Copy link

Well I'm unable to reproduce this. Maybe they have some extension like liveshare installed, which is known to cause problems with codelenses.

@ghost ghost removed the triage label Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants