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

Test should be re-discovered after switching environment. #5347

Closed
karthiknadig opened this issue Apr 17, 2019 · 2 comments · Fixed by #16769
Closed

Test should be re-discovered after switching environment. #5347

karthiknadig opened this issue Apr 17, 2019 · 2 comments · Fixed by #16769
Labels
area-testing feature-request Request for new features or functionality verified Verification succeeded
Milestone

Comments

@karthiknadig
Copy link
Member

Environment data

  • VS Code version: 1.33.1
  • Extension version (available under the Extensions sidebar): master
  • OS and version: Any
  • Python version (& distribution if applicable, e.g. Anaconda): Any
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A

Expected behavior

I have 2.7 and 3.7. If I have pytests in only in 3.7. If i was using 3.7 discovered tests then switched environments then the test explorer should be empty. Also there should be some indication of why the test discovery failed. Pytest not installed.

In the case of ptvsd, test discovery fails because of a issue in conftest.py (only on 2.7). But this is not clear, because the tests are not re-discovered when switching between 3.7 and 2.7.

ImportError while loading conftest 'c:\GIT\ptvsd\tests\conftest.py'.
C:\Users\kanadig\AppData\Roaming\Python\Python27\site-packages\six.py:709: in exec_
    exec("""exec _code_ in _globs_, _locs_""")
tests\conftest.py:16: in <module>
    from . import helpers
tests\helpers\__init__.py:92: in <module>
    from .printer import print
C:\Users\kanadig\AppData\Roaming\Python\Python27\site-packages\six.py:709: in exec_
    exec("""exec _code_ in _globs_, _locs_""")
tests\helpers\printer.py:10: in <module>
    from .ptvsd.compat import queue
E   ImportError: No module named ptvsd.compat

Actual behavior

Test explorer retains the discovered test from the previous environment.

Steps to reproduce:

  1. Open ptvsd project with 3.7

  2. Discover tests

  3. Open test explorer

  4. Change python to 2.7

  5. Test should be rediscovered (should be empty for ptvsd due to a issue with detecting tests)

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Apr 17, 2019
@DonJayamanne DonJayamanne added needs decision feature-request Request for new features or functionality labels Apr 17, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Apr 17, 2019
@karrtikr
Copy link

Still happens. Previously discovered test nodes are not removed when virtual env is changed. So even though discovery maybe retriggered.
image

@karrtikr karrtikr added the verification-found Issue verification failed label Jul 29, 2021
@karthiknadig karthiknadig added the verification-needed Verification of issue is requested label Aug 3, 2021
@brettcannon brettcannon added verified Verification succeeded and removed verification-found Issue verification failed verification-needed Verification of issue is requested labels Aug 3, 2021
@brettcannon
Copy link
Member

This is verified in the new test UI.

@karthiknadig karthiknadig added this to the August 2021 milestone Aug 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing feature-request Request for new features or functionality verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants