Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

catastrophic failure discovering TestCase with short id (e.g. doctests) #25380

Copy link
Copy link
@James-E-A

Description

@James-E-A
Issue body actions

Type: Bug

Behaviour

Test pane runs no tests and has "Show output to view error logs" message

Steps to reproduce:

  1. Create a file foo.py in your workspace:

    #!/usr/bin/env python3
    """
    >>> 2 + 2
    4
    """
    
    # (useless module does nothing, just has a single module-level test)
  2. Create a file test_foo.py in your workspace:

    import unittest
    import doctest
    import foo
    
    def load_tests(loader, tests, ignore):
        "https://docs.python.org/3/library/doctest.html#unittest-api"
        tests.addTests(doctest.DocTestSuite(foo))
        return tests
  3. Run command, Python: Configure Tests > unittest > . (Root Directory) > test_*.py (4th option); it will create this file .vscode\settings.json in your workspace:

    {
     "python.testing.unittestArgs": [
            "-v",
            "-s",
            ".",
            "-p",
            "test_*.py"
        ],
        "python.testing.pytestEnabled": false,
        "python.testing.unittestEnabled": true
    }

Diagnostic data

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

2025-08-11 11:45:58.895 [info] Discover tests for workspace name: foo- uri: c:\…\foo
2025-08-11 11:45:59.321 [error] Unittest test discovery error for workspace:  c:\…\foo 
 Traceback (most recent call last):
  File "c:\…\.vscode\extensions\ms-python.python-2025.12.0-win32-x64\python_files\unittestadapter\discovery.py", line 81, in discover_tests
    tests, error = build_test_tree(suite, top_level_dir)  # test tree built successfully here.
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\…\.vscode\extensions\ms-python.python-2025.12.0-win32-x64\python_files\unittestadapter\pvsc_utils.py", line 217, in build_test_tree
    *folders, filename, class_name, function_name = components
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected at least 3, got 1)

Extension version: 2025.10.0
VS Code version: Code 1.101.2 (2901c5ac6db8a986a5666c3af51ff804d05af0d4, 2025-06-24T20:27:15.391Z)
OS version: Windows_NT x64 10.0.22631
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 7.3.19
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
    Details
System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz (8 x 1498)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.39GB (3.74GB free)
Process Argv --crash-reporter-id 82702992-6f5e-40fb-afd0-bb10fcc152ac
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
binariesv615:30325510
h48ei257:31000450
nativeloc1:31344060
dwcopilot:31170013
bajee813:31263137
6074i472:31201624
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
pylancequickfixt:31358882
j6a0c355:31346307
convertlamdat:31358880
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31335814
nes-set-on:31340697
63221493:31336333
envsactivate1:31353494
yijiwantestdri0626-t:31336930
0927b901:31350571
f76d9909:31348711
editstats-enabled:31346257

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.