forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverifiedVerification succeededVerification succeeded
Milestone
Description
Environment data
- VS Code version: 1.33.1
- Extension version (available under the Extensions sidebar): 2019.3.6558
- OS and version: Windows 10 (Build 17134)
- Python version (& distribution if applicable, e.g. Anaconda): CPython 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)]
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
- Relevant/affected Python packages and their versions: N/A
Expected behaviour
Clicking on a test case in the test case navigates the view to the test method.
Clicking on "Open" for a test method moves the cursor to the test method definition
Actual behaviour
The file opens (if not opened before), but the view/cursor does not move. The developer console reports errors (see below).
Steps to reproduce:
# -*- coding: utf-8 -*-
import unittest
class DummyTestCase(unittest.TestCase):
def test_bar(self):
pass
def test_foo(self):
pass- Create a unittest test case
- Add source code encoding declaration at the top of the file (
# -*- coding: utf-8 -*-) - Click on a test method from the Test Explorer (or click the "Open" icon)
Works fine with Python 3.6 instead of 2.7.
Works fine without source code declaration.
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Starting Microsoft Python language server.
...
[Info - 10:11:03] Microsoft Python Language Server version 0.2.60.0
[Info - 10:11:03] Initializing for C:\Program Files\Python27\python.exe
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)
console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, c:\temp\PythonTest\TestExplorer\test_Foo.py
console.ts:134 [Extension Host] Python Extension: Python: Failed to get symbols Error: Traceback (most recent call last):
File "C:\Users\username\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\symbolProvider.py", line 95, in <module>
provide_symbols(contents)
File "C:\Users\username\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\symbolProvider.py", line 73, in provide_symbols
tree = ast.parse(source)
File "C:\Program Files\Python27\lib\ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 0
SyntaxError: encoding declaration in Unicode string
at ChildProcess.module.exports.t.ProcessService.exec.a.once (C:\Users\username\.vscode\extensions\ms-python.python-2019.3.6558\out\client\extension.js:9:38589)
at Object.onceWrapper (events.js:273:13)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
t.log @ console.ts:134
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:399
_invokeHandler @ rpcProtocol.ts:384
_receiveRequest @ rpcProtocol.ts:304
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:584
a @ ipc.net.ts:392
e @ ipc.net.ts:399
fire @ event.ts:584
_receiveMessage @ ipc.net.ts:678
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:549
fire @ event.ts:584
acceptChunk @ ipc.net.ts:212
_register._socket.onData.e @ ipc.net.ts:173
t @ ipc.net.ts:24
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
console.ts:134 [Extension Host] Python Extension: Symbol information not found Error: Symbol information not found
at l.<anonymous> (C:\Users\username\.vscode\extensions\ms-python.python-2019.3.6558\out\client\extension.js:83:833690)
at Generator.next (<anonymous>)
at s (C:\Users\username\.vscode\extensions\ms-python.python-2019.3.6558\out\client\extension.js:83:832903)
t.log @ console.ts:134
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:399
_invokeHandler @ rpcProtocol.ts:384
_receiveRequest @ rpcProtocol.ts:304
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:584
a @ ipc.net.ts:392
e @ ipc.net.ts:399
fire @ event.ts:584
_receiveMessage @ ipc.net.ts:678
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:549
fire @ event.ts:584
acceptChunk @ ipc.net.ts:212
_register._socket.onData.e @ ipc.net.ts:173
t @ ipc.net.ts:24
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
console.ts:134 [Extension Host] Python Extension: Unable to navigate to test function Error: Test Function not found
at g.<anonymous> (C:\Users\username\.vscode\extensions\ms-python.python-2019.3.6558\out\client\extension.js:83:831974)
at Generator.next (<anonymous>)
at s (C:\Users\username\.vscode\extensions\ms-python.python-2019.3.6558\out\client\extension.js:83:830607)
t.log @ console.ts:134
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:399
_invokeHandler @ rpcProtocol.ts:384
_receiveRequest @ rpcProtocol.ts:304
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:584
a @ ipc.net.ts:392
e @ ipc.net.ts:399
fire @ event.ts:584
_receiveMessage @ ipc.net.ts:678
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:549
fire @ event.ts:584
acceptChunk @ ipc.net.ts:212
_register._socket.onData.e @ ipc.net.ts:173
t @ ipc.net.ts:24
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugverifiedVerification succeededVerification succeeded