question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding markers (@mark.asyncio) make discovery fails

See original GitHub issue

Type: Bug

Hello,

I have a strange issue and test discovery. While making new test asynchronus, the test discovery began to broke. With the exact same test case, adding only async markers and async test methods, the discovery fails with asyncs on, and pass correctly wihout them.

I looked at the output of the discovery command, both are exactly the same expect for the line number due to markers being added.

Test run correctly directly from command line.

Behaviour

Expected vs. Actual

Expected

Discovery works

Actual

Discovery fails without any error message

Discovery outputs

Ok: https://drive.google.com/file/d/1Zqsxk8pW_hcttCnAFydbOqyNX_KU1-ul/view?usp=share_link

Ko: https://drive.google.com/file/d/18aocozebcQ1Rfwsz_g9_CVtiTs40Zxzf/view?usp=share_link

Steps to reproduce:

I do not know how to reproduce on a simpler code base. Already added some async markers without issue so it feel strange.

I will try to reproduce on simpler project

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.7
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

 ~/venv/bin/python ~/.vscode-server/extensions/ms-python.python-2022.18.2/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear
cwd: .
[ERROR 2022-10-29 19:43:10.76]: Error discovering pytest tests:
 [n [Error]: Waiting up to 5 seconds.
Sent all pending logs.

	at ChildProcess.<anonymous> (/home/vscode/.vscode-server/extensions/ms-python.python-2022.18.2/out/client/extension.js:2:242843)
	at Object.onceWrapper (node:events:646:26)
	at ChildProcess.emit (node:events:526:28)
	at maybeClose (node:internal/child_process:1092:16)
	at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)]

User Settings


languageServer: "Pylance"

linting
• flake8Enabled: true
• banditArgs: "<placeholder>"
• banditEnabled: true
• mypyEnabled: true

formatting
• provider: "black"
• blackArgs: "<placeholder>"

testing
• cwd: "<placeholder>"
• pytestEnabled: true

Extension version: 2022.18.2 VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T03:54:53.913Z) OS version: Linux x64 6.0.6-76060006-generic Modes: Sandboxed: No Remote OS version: Linux x64 6.0.6-76060006-generic

System Info
Item Value
CPUs Intel® Core™ i7-8700 CPU @ 3.20GHz (12 x 4299)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 31.27GB (23.03GB free)
Process Argv –unity-launch --crash-reporter-id 9193f995-a3c7-4d94-9dd7-1fdc933506b2
Screen Reader no
VM 0%
DESKTOP_SESSION pop
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP pop
XDG_SESSION_TYPE x11
Item Value
Remote Dev Container: Bet On You API
OS Linux x64 6.0.6-76060006-generic
CPUs Intel® Core™ i7-8700 CPU @ 3.20GHz (12 x 4299)
Memory (System) 31.27GB (23.03GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vscaac:30438847
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyonecf:30548226
pyindex848:30577860
nodejswelcome1:30587005
3biah626:30602489
gswce1:30612156
iaj6b796:30613358
dbltrim-noruby:30604474
f6dab269:30613381

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eleanorjboydcommented, Dec 16, 2022

Hello @titouanfreville! Sorry for the delay in circling back. Yes you are correct about it relating to #18431 and therefore the fix for it is the feature request, https://github.com/microsoft/vscode-python/issues/17171. Given we already have an issue tracking this I am going to close this issue in favor of the feature request. Thank you again for all your work debugging and I am sorry you encountered this lack of functionality with environment variables.

0reactions
eleanorjboydcommented, Dec 2, 2022

@titouanfreville, thank you for the extra info! I will look into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to mark all coroutine tests with marker? #1793 - GitHub
I'd like to automate the process of marking these coroutines tests. The best I could do after couple of hours of trying, reading...
Read more >
Pytest with Marking, Mocking, and Fixtures in 10 Minutes
To implement mocking, install the pytest-mock Python package. In this example within the src/sample_file.py file, we define the desired function and function ...
Read more >
For what 'pytest.mark.asyncio' is used? - Stack Overflow
When your tests are marked with @pytest.mark.asyncio , they become coroutines, together with the keyword await in body.
Read more >
How to make sure your asyncio tests always run - Quantlane
The one extra thing you need to do is to always mark your test functions with the @pytest.mark.asyncio decorator. See the following example ......
Read more >
Async IO in Python: A Complete Walkthrough
This tutorial will give you a firm grasp of Python's approach to async IO, which is a concurrent programming design that has received...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found