You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test should be re-discovered after switching environment. #5347
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 helperstests\helpers\__init__.py:92: in <module> from .printer import printC:\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 queueE ImportError: No module named ptvsd.compat
Actual behavior
Test explorer retains the discovered test from the previous environment.
Steps to reproduce:
Open ptvsd project with 3.7
Discover tests
Open test explorer
Change python to 2.7
Test should be rediscovered (should be empty for ptvsd due to a issue with detecting tests)
Activity
karrtikr commentedon Jul 29, 2021
Still happens. Previously discovered test nodes are not removed when virtual env is changed. So even though discovery maybe retriggered.

brettcannon commentedon Aug 3, 2021
This is verified in the new test UI.