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

Clicking on a test in the Test Explorer does not navigate to the correct test #8448

Closed
kimadeline opened this issue Nov 7, 2019 · 1 comment · Fixed by #16769
Closed
Labels
area-testing bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release verified Verification succeeded
Milestone

Comments

@kimadeline
Copy link

kimadeline commented Nov 7, 2019

Environment data

  • VS Code version: 1.40
  • Extension version (available under the Extensions sidebar): 2019.10.44104
  • OS and version: macOS 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): XXX
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Python 3.7.4 venv
  • Relevant/affected Python packages and their versions: pytest 5.1.3
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): N/A

Expected behaviour

Clicking on a test in the test explorer should navigate to the correct test in the correct test file.

Actual behaviour

Clicking on a test in the test explorer navigates to the correct test file but the cursor ends up in a random place in the file.

Steps to reproduce:

  1. Have the following folder structure:
root/
   .vscode/settings.json
   hello.py
   tests/
         test_file.py

with test_file.py containing

"""Example test"""


def test_file_one():
    print("hello")
    assert True


def test_file_two():
    print("world")
    assert True

and hello.py containing print("hello world").

  1. Activate the python extension by opening hello.py
  2. Discover tests using pytest
  3. Expand the test folder structure and click on test_file_one and then test_file_two
  4. Observe that not only is the cursor not located at the def test_file_one line, but it also doesn't move when clicking on a different test.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

> ~/Documents/Sandbox/hello-world/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2019.10.44104/pythonFiles/symbolProvider.py ~/Documents/Sandbox/hello-world/tests/test_file.py

👉 The information returned by > ~/Documents/Sandbox/hello-world/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2019.10.44104/pythonFiles/symbolProvider.py ~/Documents/Sandbox/hello-world/tests/test_file.py is correct:

{
   "classes":[],
   "methods":[],
   "functions":[
      {
         "namespace":"",
         "name":"test_file_one",
         "range":{
            "start":{
               "line":3,
               "character":0
            },
            "end":{
               "line":5,
               "character":4
            }
         }
      },
      {
         "namespace":"",
         "name":"test_file_two",
         "range":{
            "start":{
               "line":8,
               "character":0
            },
            "end":{
               "line":10,
               "character":4
            }
         }
      }
   ]
}
@kimadeline kimadeline added bug Issue identified by VS Code Team member as probable bug area-testing triage-needed Needs assignment to the proper sub-team labels Nov 7, 2019
@karthiknadig karthiknadig self-assigned this Nov 11, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Nov 11, 2019
@karthiknadig karthiknadig removed their assignment Nov 11, 2019
@karthiknadig karthiknadig added the regression Bug didn't exist in a previous release label Nov 11, 2019
@brettcannon
Copy link
Member

This is fixed in the upcoming test provider.

Animation

@brettcannon brettcannon added the verified Verification succeeded label Jul 29, 2021
@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 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants