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:
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").
Activate the python extension by opening hello.py
Discover tests using pytest
Expand the test folder structure and click on test_file_one and then test_file_two
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 (View→Output, 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
}
}
}
]
}
Environment data
"python.jediEnabled"set to; more info How to update the language server to the latest stable version #3977): N/AExpected 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:
with
test_file.pycontainingand
hello.pycontainingprint("hello world").hello.pytest_file_oneand thentest_file_twodef test_file_oneline, but it also doesn't move when clicking on a different test.Logs
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)👉 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.pyis 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 } } } ] }