Skip to content

pytest 5.1.0 seems to break the test adapter #6990

Closed

Description

@krazyace78

Issue Type: Bug

After updating VSCode from v1.36.1 to v1.37.1 (in WSL), pytest unit tests are no longer displaying green/red status in the side bar. An error pop-up is displayed with the following message:

There was an error in running the tests.
Source Python (Extension)

The OUTPUT tab indicates that the test passed, but there is also an error message that seems like it is related to the extension issue:

============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-5.1.0, py-1.8.0, pluggy-0.12.0
rootdir: /mnt/c/Users/.../
plugins: cov-2.7.1
collected 1 item

tests/test___init__.py .                                                 [100%]

-------------- generated xml file: /tmp/tmp-2499XLU6ay233ncl.xml ---------------
============================== 1 passed in 0.06s ===============================
Error: TypeError: Cannot read property '$' of undefined

Extension version: 2019.8.30787
VS Code version: Code 1.37.1 (f06011ac164ae4dc8e753a3fe7f9549844d15e35, 2019-08-15T16:17:55.855Z)
OS version: Windows_NT x64 10.0.17134
Remote OS version: Linux x64 4.4.0-17134-Microsoft

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU X5650 @ 2.67GHz (12 x 3800)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 24.00GB (14.93GB free)
Process Argv --folder-uri=vscode-remote://wsl+default/mnt/c/Users/.../ --remote=wsl+default
Screen Reader no
VM 50%
Item Value
Remote WSL
OS Linux x64 4.4.0-17134-Microsoft
CPUs Intel(R) Xeon(R) CPU X5650 @ 2.67GHz (12 x 3800)
Memory (System) 24.00GB (14.93GB free)
VM 50%

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Aug 16, 2019
  2. marsfan commented on Aug 16, 2019

    @marsfan

    Jason (@krazyace78) @pvscbot

    Also mentioning Johnnyxy and BLeAm as I see they posted a reaction to it.

    I have the same issue.
    I believe this is unrelated to updating Visual Studio Code. I just ran some tests, and the issue seems to be with pytest 5.1.0.

    Try downgrading to pytest 5.0.1 (via pip install -U pytest==5.0.1), as that fixed it for me.
    Attached is my output from the developer console:

    onDidNotificationChange @ notificationsAlerts.ts:40
    _register.model.onDidNotificationChange.e @ notificationsAlerts.ts:26
    fire @ event.ts:572
    addNotification @ notifications.ts:156
    notify @ notificationService.ts:55
    r @ mainThreadMessageService.ts:83
    _showMessage @ mainThreadMessageService.ts:44
    $showMessage @ mainThreadMessageService.ts:38
    _doInvokeHandler @ rpcProtocol.ts:394
    _invokeHandler @ rpcProtocol.ts:379
    _receiveRequest @ rpcProtocol.ts:299
    _receiveOneMessage @ rpcProtocol.ts:226
    _protocol.onMessage.e @ rpcProtocol.ts:101
    fire @ event.ts:572
    a @ ipc.net.ts:421
    e @ ipc.net.ts:428
    fire @ event.ts:572
    _receiveMessage @ ipc.net.ts:715
    S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
    fire @ event.ts:572
    acceptChunk @ ipc.net.ts:236
    _register._socket.onData.e @ ipc.net.ts:197
    t @ ipc.net.ts:28
    emit @ events.js:182
    addChunk @ _stream_readable.js:283
    readableAddChunk @ _stream_readable.js:264
    Readable.push @ _stream_readable.js:219
    onStreamRead @ internal/stream_base_commons.js:94
    notificationsAlerts.ts:38 Error: Cannot read property '$' of undefined
    	at module.exports.i.readFile.n.parseString (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\extension.js:75:948003)
    	at l.<anonymous> (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:50429)
    	at l.emit (events.js:182:13)
    	at i.onclosetag (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:49765)
    	at I (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:2:6036)
    	at A (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:2:6075)
    	at M (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:2:9359)
    	at i.write (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:58596)
    	at l.module.exports.904.e.Parser.l.parseString (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:50669)
    	at l.module.exports.904.h [as parseString] (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:45293)
    	at Object.module.exports.904.e.parseString (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\node_modules\xml2js.js:1:51007)
    	at module.exports.i.readFile (c:\Users\Gabe\.vscode\extensions\ms-python.python-2019.8.30787\out\client\extension.js:75:947919)
    	at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)```
    
  3. marsfan commented on Aug 16, 2019

    @marsfan

    Upon further examination, the output between 5.1.0 and 5.0.1 seems to be the same, so I do not know why this would trigger an error, but I know that downgrading to 5.0.1 fixed it for me.

  4. BLeAm commented on Aug 17, 2019

    @BLeAm

    Gabe R. (@marsfan) Thank you for mentioning me and the workaround.

  5. krazyace78 commented on Aug 17, 2019

    @krazyace78
    Author

    Thank you for the workaround Gabe R. (@marsfan)!

  6. vthorsteinsson commented on Aug 18, 2019

    @vthorsteinsson

    I have the same issue, and the workaround did the trick for me. Thanks Gabe R. (@marsfan)!

  7. cornel-masson commented on Aug 19, 2019

    @cornel-masson

    +1 works for me now Gabe R. (@marsfan)
    In case someone has the same issues: to downgrade pytest to 5.0.1, uninstall it first (e.g. pipenv uninstall pytest), then add the dependency in your Pipfile as "<=5.0.1" and re-install (e.g. pipenv install pytest).

  8. Johnnyxy commented on Aug 19, 2019

    @Johnnyxy

    Additionally, if you do not use any environments:

    global install: pip install --force-reinstall pytest==5.0.1

    user install: pip install --user --force-reinstall pytest==5.0.1

  9. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Aug 19, 2019
  10. changed the title [-]TEST:PYTHON pytest unit test status is no longer working[/-] [+]pytest 5.1.0 seems to break the test adapter[/+] on Aug 19, 2019
  11. 8 remaining items

  12. ezequias commented on Sep 17, 2019

    @ezequias

    The suggestion of Gabe R. (@marsfan) was great but while I am debugging I faced with the following error after the last instruction, my assertion
    self.assertEqual(response.status_code, 200)
    The error I got (after the last F10) is:
    Could not load source '': Source unavailable.

  13. JosephTLyons commented on Sep 17, 2019

    @JosephTLyons

    Downgrading to 5.0.1 fixed my issues with VS Code and PyTest

  14. wagneripjr commented on Sep 23, 2019

    @wagneripjr

    Downgrading pytest fixed my issues, thanks Gabe R. (@marsfan)

  15. karrtikr commented on Sep 23, 2019

    @karrtikr

    Hi all, it's fixed in the insiders version of the extension now. (You can use Switch to insiders weekly command from CmdPalette to download the latest version of the extension)

    The fix will be out in the next stable release.

  16. added a commit that references this issue on Sep 24, 2019
  17. locked as resolved and limited conversation to collaborators on Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-testingbugIssue identified by VS Code Team member as probable bugimportantIssue identified as high-priority

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions