Skip to content

Incorrect django test coverage report with parallel tests #25597

@sainak

Description

@sainak

Type: Bug

Behaviour

Running tests in parallel with coverage gives incorrect results

Steps to reproduce:

  1. Create django unittest suites

  2. Use the follwing test args:

"python.testing.unittestArgs": [
    "--noinput",
    "--shuffle",
    "--parallel",
    "--keepdb"
  ],
  1. Tun the tests with coverage

Expected behaviour

The extension should combine the test results from parallel runs while reporting the coverage

ref: https://docs.djangoproject.com/en/5.2/internals/contributing/writing-code/unit-tests/#code-coverage

Diagnostic data

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

2025-11-19 14:30:09.274 [info] MANAGE_PY_PATH is set, running Django discovery with path to manage.py as: $./manage.py

2025-11-19 14:30:09.274 [info] Running Django tests with command: ['/Users/user/.local/share/virtualenvs/dj-app-tnTrOaDS/bin/python', './manage.py', 'test', '--testrunner=django_test_runner.CustomDiscoveryTestRunner', '--noinput', '--shuffle', '--parallel', '--keepdb']

2025-11-19 14:30:11.327 [error] 

2025-11-19 14:30:11.327 [info] Using shuffle seed: 7640050632 (generated)
Found 1152 test(s).


2025-11-19 14:30:14.071 [info] Running UNITTEST execution for the following test ids: ....


2025-11-19 14:32:02.180 [info] Attempting to use temp directory for test ids file, file name: test-ids-11f98e997c358961993b.txt
2025-11-19 14:32:02.181 [info] All environment variables set for unittest execution, PYTHONPATH: "/Users/user/Projects/dj-app"
2025-11-19 14:32:02.182 [info] Running unittests for workspace /Users/user/Projects/dj-app with arguments: /Users/user/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/unittestadapter/execution.py,--udiscovery,--noinput,--shuffle,--parallel,--keepdb

2025-11-19 14:32:02.182 [info] > ~/.local/share/virtualenvs/dj-app-tnTrOaDS/bin/python ~/.vscode/extensions/ms-python.python-2025.18.0-darwin-arm64/python_files/unittestadapter/execution.py --udiscovery --noinput --shuffle --parallel --keepdb
2025-11-19 14:32:02.182 [info] cwd: .
2025-11-19 14:32:31.350 [info] Test Result named pipe /var/folders/0n/4qvkqnzs3sl7w6m5vb1vxn9m0000gn/T/python-test-results-be3ef89e529d3fca4b1f  cancelled

Extension version: 2025.18.0
VS Code version: Code 1.106.1 (cb1933bbc38d329b3595673a600fab5c7368f0a7, 2025-11-16T10:20:23.745Z)
OS version: Darwin arm64 25.1.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.9
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): PipEnv
  • Value of the python.languageServer setting: Pylance
User Settings


languageServer: "Pylance"

testing
• unittestArgs: "<placeholder>"
• unittestEnabled: true

terminal
• activateEnvironment: false

Installed Extensions
Extension Name Extension Id Version
astro-vscode ast 2.15.4
azure-repos ms- 0.40.0
biome bio 3.3.0
black-formatter ms- 2025.2.0
Bookmarks ale 13.5.0
boto3-ide Bot 0.6.0
code-spell-checker str 4.3.2
codespaces Git 1.18.0
copilot Git 1.388.0
copilot-chat Git 0.33.1
cpptools ms- 1.28.3
debugpy ms- 2025.16.0
docker doc 0.18.0
even-better-toml tam 0.21.2
gc-excelviewer Gra 4.2.64
git-graph mhu 1.30.0
github-vscode-theme Git 6.3.5
gitlens eam 17.7.1
go gol 0.50.0
isort ms- 2025.0.0
js-debug ms- 1.105.0
js-debug-companion ms- 1.1.3
jupyter ms- 2025.9.1
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
latex-workshop Jam 10.11.3
live-server ms- 0.4.16
LiveServer rit 5.7.9
material-icon-theme PKi 5.28.0
postgrestools Sup 1.3.2
prettier-vscode esb 11.0.0
pretty-ts-errors Yoa 0.6.1
prisma Pri 6.19.0
python ms- 2025.18.0
python-path mge 0.0.14
remote-containers ms- 0.431.1
remote-explorer ms- 0.5.0
remote-repositories ms- 0.42.0
remote-ssh ms- 0.120.0
remote-ssh-edit ms- 0.87.0
remotehub Git 0.64.0
rescript-vscode che 1.66.0
ruby-lsp Sho 0.9.32
ruff cha 2025.28.0
rust-analyzer rus 0.3.2683
sorbet-vscode-extension sor 0.3.46
svelte-vscode sve 109.12.0
tauri-vscode tau 0.2.9
todo-tree Gru 0.0.226
vscode-containers ms- 2.3.0
vscode-coverage-gutters rya 2.14.0
vscode-docker ms- 2.0.0
vscode-eslint dba 3.0.16
vscode-firefox-debug fir 2.15.0
vscode-github-actions git 0.28.0
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-pull-request-github Git 0.122.0
vscode-pylance ms- 2025.9.1
vscode-python-envs ms- 1.12.0
vscode-scss mrm 0.10.0
vscode-styled-jsx-syntax Div 1.3.1
vscode-tailwindcss bra 0.14.29
vscode-theme-onedark aka 2.3.0
vscode-thunder-client ran 2.38.5
vsliveshare ms- 1.0.5959
System Info
Item Value
CPUs Apple M2 (8 x 2400)
GPU Status 2d_canvas: enabled
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) 18, 7, 5
Memory (System) 16.00GB (0.30GB free)
Process Argv
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-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