Repository navigation
Labels
area-testingauthor-verification-requestedIssues potentially verifiable by issue authorverifiedVerification succeeded
Milestone
Description
Type: Bug
Behaviour
Expected vs. Actual
The new pytest runner does not handle properly error raised in test setup/fixture evaluation, nor skipping tests. When an error is raised, it should show a red circle with a red dot inside for the failed test, but it show a grey dot instead. Note that the test is not FAILED but is in ERROR. The same applies for skipped test, the same icon isued
Steps to reproduce:
- Write the following test file:
import pytest
@pytest.fixture
def raise_fixture():
raise Exception("Dummy exception")
class TestSomething:
def test_a(self, raise_fixture):
assert True- Run the test, it should
ERROR - Check the test explorer which shows:

instead of (using old test runner):

Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.2
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServersetting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
XXX
User Settings
Multiroot scenario, following user settings may not apply:
languageServer: "Pylance"
formatting
• provider: "yapf"
experiments
• optInto: ["pythonTestAdapter"]
Extension version: 2023.12.0
VS Code version: Code 1.80.0 (660393deaaa6d1996740ff4880f1bad43768c814, 2023-07-04T13:39:48.236Z)
OS version: Linux x64 5.15.0-75-generic
Modes:
Remote OS version: Linux x64 5.15.0-75-generic
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30776702
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30610678
2e4cg342:30602488
pyind779:30671433
89544117:30613380
pythonsymbol12:30671437
2i9eh265:30646982
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
hideindicator:30766889
pythongtdpath:30769146
bgfeh915:30780428
pythonnosmt12:30779714
pythonidxpt:30784022
pythonnoceb:30776495
e537b577:30772215
Metadata
Metadata
Assignees
Labels
area-testingauthor-verification-requestedIssues potentially verifiable by issue authorverifiedVerification succeeded
Activity
[-]Error in test setup is shown as if test never ran[/-]eleanorjboyd commentedon Jul 10, 2023
Thanks again for the help! I can repro and I am putting in a fix now. Thanks
Return exceptions & skips correctly pytest (#21603)
eleanorjboyd commentedon Jul 10, 2023
Hi! This will be out on the insiders build of the python extension tomorrow. If you would like to try and let me know if it works that would be great! Thanks
lmgarret commentedon Jul 11, 2023
Thanks for the quick action! It seems to fix the issue:
There still is a bugged case: if a test class is skipped, the icon stays as if the test never ran (same as described in the issue).
eleanorjboyd commentedon Jul 11, 2023
Ah yes thank you for the additional note- will look into that now
handle skipped marker on class level (#21612)
eleanorjboyd commentedon Jul 12, 2023
The second fix will be out tomorrow on the nightly release of the extension. I made it work for the following test case which should encompass your scenario. If you could test it tomorrow that would be great and generally appreciate all the help!
lmgarret commentedon Jul 13, 2023
Good to hear thanks! I'll test it next week since I'm currently off
lmgarret commentedon Jul 19, 2023
Just tested the latest version and it did fix it, thanks
Merged PR posit-dev/positron-python#151: Merge upstream as of 2023 Ju…
Merged PR posit-dev/positron-python#151: Merge upstream as of 2023 Ju…