Skip to content

pytest should use "-rs" by default #25918

Open

Description

@roysmith

Type: Bug

I'm trying to run the test suite from pywikibot (https://github.com/wikimedia/pywikibot/blob/master/tests/site_tests.py). I'm not sure this will be reproducible in other environments, but when I run a test which requires the user to be logged in and I'm not, say site_tests.py::TestRollbackPage, the test is skipped due to https://github.com/wikimedia/pywikibot/blob/2673a807c54d066a03622b3e9a75bb3ca36ba3cb/tests/aspects.py#L717

So far, so good. The problem is all it prints is:

Running pytest with args: ['-p', 'vscode_pytest', '-vv', '--rootdir=/Users/roysmith/dev/pywikibot', '/Users/roysmith/dev/pywikibot/core/tests/site_tests.py::TestRollbackPage::test_exceptions', '/Users/roysmith/dev/pywikibot/core/tests/site_tests.py::TestRollbackPage::test_missing_rights', '/Users/roysmith/dev/pywikibot/core/tests/site_tests.py::TestRollbackPage::test_rollback_simulation']
============================= test session starts ==============================
platform darwin -- Python 3.11.8, pytest-9.0.3, pluggy-1.6.0 -- /Users/roysmith/dev/pywikibot/venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/roysmith/dev/pywikibot
configfile: core/tox.ini
collecting ... collected 3 items

core/tests/site_tests.py::TestRollbackPage::test_exceptions SKIPPED      [ 33%]
core/tests/site_tests.py::TestRollbackPage::test_missing_rights SKIPPED  [ 66%]
core/tests/site_tests.py::TestRollbackPage::test_rollback_simulation SKIPPED [100%]

============================== 3 skipped in 0.91s ==============================
Finished running tests!

It does NOT print the reason string. If I run the same command in a shell window, it DOES print the reasons:

(pywikibot) roysmith@Roys-Mac-Mini pywikibot % pytest  '-vv' '--rootdir=/Users/roysmith/dev/pywikibot' '/Users/roysmith/dev/pywikibot/core/tests/site_tests.py::TestRollbackPage'                      
======================================================================================================= test session starts ========================================================================================================
platform darwin -- Python 3.11.8, pytest-9.0.3, pluggy-1.6.0 -- /Users/roysmith/dev/pywikibot/venv/bin/python3.11
cachedir: .pytest_cache
rootdir: /Users/roysmith/dev/pywikibot
configfile: core/tox.ini
collected 3 items                                                                                                                                                                                                                  

core/tests/site_tests.py::TestRollbackPage::test_exceptions SKIPPED (TestRollbackPage: No username for wikipedia:test)                                                                                                       [ 33%]
core/tests/site_tests.py::TestRollbackPage::test_missing_rights SKIPPED (TestRollbackPage: No username for wikipedia:test)                                                                                                   [ 66%]
core/tests/site_tests.py::TestRollbackPage::test_rollback_simulation SKIPPED (TestRollbackPage: No username for wikipedia:test)                                                                                              [100%]

======================================================================================================== 3 skipped in 0.94s ========================================================================================================

I don't understand why the printing of the reasons was suppressed when run under VS Code, but adding "-rs" to the pytest command forces them to be printed:

% cat .vscode/settings.json
{
    "python.testing.pytestEnabled": true,
    "python.testing.pytestArgs": [
        "core/tests",
        "-vv",
        "-rs"
    ]
}

I can't see any downside to always printing this information (nor do I understand why pytest even gives you the option to turn it off), but adding the -rs by default to always print it seems like the right thing to do.

Behaviour

XXX

Steps to reproduce:

  1. XXX

Diagnostic data

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

XXX

Extension version: 2026.4.0
VS Code version: Code 1.116.0 (560a9dba96f961efea7b1612916f89e5d5d4d679, 2026-04-15T00:28:13Z)
OS version: Darwin arm64 23.5.0
Modes:

System Info
Item Value
CPUs Apple M2 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M2 Pro, Version 14.5 (Build 23F79))], DRIVER_VENDOR=Apple, DRIVER_VERSION=14.5 ACTIVE
Machine model name: Mac
Machine model version: 14.12
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_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 32.00GB (1.94GB free)
Process Argv --crash-reporter-id 48ec6b81-7fc7-4b32-8cba-722cb78c9b37
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsactivate1:31464700
cloudbuttont:31379625
3efgi100_wstrepl:31403338
55ia6109:31457054
use-responses-api:31390855
je187915:31401254
ec5jj548:31422691
cp_cls_c_966_ss:31454199
inlinechat_v2_hd992725:31485760
c3h7c220:31478652
38bie571_auto:31426784
cp_cls_c_1081:31454833
conptydll_true:31489736
e9c30283:31461165
test_treatment2:31471001
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
534a6447:31496642
chat:31457767
cpptoolson-v2:31475363
ghj88844:31492074
ec1eg703:31491645
client_tst_t:31495907
ddid_t:31478206
getcmakediagnosticsoff:31489825
cp_cls_c_1082:31491634
logging_disabled_new:31493366

Activity

  1. github-actions commented on May 1, 2026

    @github-actions

    Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

  2. roysmith commented on May 1, 2026

    @roysmith
    Author

    Sounds reasonable, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalityneeds community feedbackAwaiting community feedbacktriage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions