You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the python discovery was revamped (I don't recall when), my test discovery stopped working with pytest, giving the following message:
python <HOME_PATH>/.vscode/extensions/ms-python.python-2019.10.41019/pythonFiles/testing_tools/run_adapter.py discover pytest -- -s --cache-clear -vvv -ra --color=no --no-cov test
Test Discovery failed:
Error: 2019-10-23 11:24:14 <SOME MESSAGE FROM IN-HOUSE CODE>
The problem is caused by an internal pytest plugin that runs subprocess.check_output like this:
...
stdout=subprocess.check_output(arguments)
# Parse the output to discover some paths
...
This subprocess write some log messages to stderr and those messages go directly to the current process' stderr, not sys.stderr.
So when vscode runs the run_adapter.py script, the following code can't capture those log messages:
with (util.hide_stdio() ifhidestdioelseutil.noop_cm()) asstdio:
ec=_pytest_main(pytestargs, [_plugin])
When running the run_adapter.py script manually I get:
2019-10-23 11:06:33 <SOME MESSAGE FROM IN-HOUSE CODE>
[<JSON_CONTENT>]
But if I run the script re-directing stderr (i.e. 2> /dev/null), I get only the json content.
So while we can fix this on our side by doing subprocess.check_output(arguments, stderr=sys.stderr), I believe it would be better if vscode tries to parse only run_adapter.py's stdout. Otherwise anyone using subprocess or doing something else that writes to the process' stderr can break vscode test discovery.
Extension version: 2019.10.41019
VS Code version: Code 1.39.2 (6ab598523be7a800d7f3eb4d92d7ab9a66069390, 2019-10-15T15:33:40.634Z)
OS version: Linux x64 4.15.0-65-generic
System Info
Item
Value
CPUs
Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz (4 x 3441)
Issue Type: Bug
Since the python discovery was revamped (I don't recall when), my test discovery stopped working with pytest, giving the following message:
The problem is caused by an internal pytest plugin that runs
subprocess.check_output
like this:This subprocess write some log messages to stderr and those messages go directly to the current process' stderr, not sys.stderr.
So when vscode runs the
run_adapter.py
script, the following code can't capture those log messages:When running the
run_adapter.py
script manually I get:But if I run the script re-directing stderr (i.e.
2> /dev/null
), I get only the json content.So while we can fix this on our side by doing
subprocess.check_output(arguments, stderr=sys.stderr)
, I believe it would be better if vscode tries to parse onlyrun_adapter.py
's stdout. Otherwise anyone using subprocess or doing something else that writes to the process' stderr can break vscode test discovery.Extension version: 2019.10.41019
VS Code version: Code 1.39.2 (6ab598523be7a800d7f3eb4d92d7ab9a66069390, 2019-10-15T15:33:40.634Z)
OS version: Linux x64 4.15.0-65-generic
System Info
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: disabled_software
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: unavailable_off
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: