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

pytest 5.1.0 seems to break the test adapter #6990

Closed
krazyace78 opened this issue Aug 16, 2019 · 14 comments

Comments

@krazyace78
Copy link

commented Aug 16, 2019

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%
@pvscbot pvscbot added the classify label Aug 16, 2019
@Marsfan

This comment has been minimized.

Copy link

commented Aug 16, 2019

@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)```
@Marsfan

This comment has been minimized.

Copy link

commented Aug 16, 2019

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.

@BLeAm

This comment has been minimized.

Copy link

commented Aug 17, 2019

@Marsfan Thank you for mentioning me and the workaround.

@krazyace78

This comment has been minimized.

Copy link
Author

commented Aug 17, 2019

Thank you for the workaround @Marsfan!

@vthorsteinsson

This comment has been minimized.

Copy link

commented Aug 18, 2019

I have the same issue, and the workaround did the trick for me. Thanks @Marsfan!

@cornel-masson

This comment has been minimized.

Copy link

commented Aug 19, 2019

+1 works for me now @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).

@Johnnyxy

This comment has been minimized.

Copy link

commented Aug 19, 2019

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

@karrtikr karrtikr added the triage label Aug 19, 2019
@pvscbot pvscbot removed the classify label Aug 19, 2019
@brettcannon brettcannon changed the title TEST:PYTHON pytest unit test status is no longer working pytest 5.1.0 seems to break the test adapter Aug 19, 2019
@ericsnowcurrently

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

@krazyace78, thanks for letting us know about this. It looks like pytest 5.1.0 changed something in their XML output. We'll get this fixed as soon as we can.

@zazazack

This comment has been minimized.

Copy link

commented Aug 25, 2019

Also need to uninstall and reinstall pytest-cov after downgrading

@karrtikr

This comment has been minimized.

Copy link

commented Aug 28, 2019

Prescribed solution

@karrtikr karrtikr added this to the September sprint 2019.1 milestone Aug 28, 2019
sindrehan added a commit to BluEye-Robotics/blueye.sdk that referenced this issue Aug 29, 2019
Due to a bug with VSCode running tests with pytest 5.1 fails, so
locking to 5.0.1 until that is fixed. See
microsoft/vscode-python#6990
paxcodes added a commit to paxcodes/peppsnipp-api that referenced this issue Aug 31, 2019
Error: TypeError: Cannot read property '$' of undefined
microsoft/vscode-python#6990 (comment)
jdkent added a commit to jdkent/NiBetaSeries that referenced this issue Aug 31, 2019
jdkent added a commit to HBClab/NiBetaSeries that referenced this issue Sep 3, 2019
* add the vscode folder for development settings

* pin pytest version
microsoft/vscode-python#6990

* make docker development file

* update manifest

* add docker toolbox visual instructions

* add code-server instructions
eliminate broken links
misc spelling

* add static file path in conf.py

* add restructeredtext previewer

* change default settings including not showing gitlens intro screen

* add optional devel build [build]

* add documentation for adding git credentials to docker container [build devel]

* make pip install editable

* add restructuredtext to list of extensions installed
@ezequias

This comment has been minimized.

Copy link

commented Sep 17, 2019

The suggestion of @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.

@JosephTLyons

This comment has been minimized.

Copy link

commented Sep 17, 2019

Downgrading to 5.0.1 fixed my issues with VS Code and PyTest

ericsnowcurrently added a commit that referenced this issue Sep 19, 2019
This is a precursor to the fix for #6990.
salchichongallo added a commit to becas-itm/becas-itm that referenced this issue Sep 20, 2019
Newer version of pytest (5.1.0) seems to break the VSCode test adapter.

See microsoft/vscode-python#6990 for more information.
@wagneripjr

This comment has been minimized.

Copy link

commented Sep 23, 2019

Downgrading pytest fixed my issues, thanks @Marsfan

@karrtikr

This comment has been minimized.

Copy link

commented Sep 23, 2019

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.

@karrtikr karrtikr closed this Sep 23, 2019
@pvscbot pvscbot removed the needs PR label Sep 23, 2019
sindrehan added a commit to BluEye-Robotics/blueye.protocol that referenced this issue Sep 24, 2019
VSCode issue was solved in latest insiders version
(microsoft/vscode-python#6990 (comment))
@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.