Skip to content

Django test discovering #24991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Zankroh opened this issue Apr 18, 2025 · 3 comments
Open

Django test discovering #24991

Zankroh opened this issue Apr 18, 2025 · 3 comments
Assignees
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@Zankroh
Copy link

Zankroh commented Apr 18, 2025

Type: Bug

Behaviour

When trying to discover Django unit tests, the command manage.py fails with the error error: argument -v/--verbosity: expected one argument.
I'm using Python 3.12.4 and Django 5.2

Steps to reproduce:

  1. Open a Django project
  2. Go to Testing tab
  3. Click refresh button

Diagnostic data

Output for Python in the Output panel

2025-04-18 11:48:31.360 [info] Discover tests for workspace name: accounting - uri: c:\Users\xxxxx\Projects\accounting
2025-04-18 11:48:31.361 [info] Discovering unittest tests for workspace c:\Users\xxxxx\Projects\accounting with arguments: c:\Users\xxxxx\.vscode\extensions\ms-python.python-2025.5.2025041601-win32-x64\python_files\unittestadapter\discovery.py,--udiscovery,-v,-s,.,-p,*test.py

2025-04-18 11:48:31.367 [info] > .\env\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2025.5.2025041601-win32-x64\python_files\unittestadapter\discovery.py --udiscovery -v -s . -p *test.py
2025-04-18 11:48:31.367 [info] cwd: .
2025-04-18 11:48:31.519 [info] MANAGE_PY_PATH is set, running Django discovery with path to manage.py as: $C:\Users\xxxxx\Projects\accounting\manage.py
Running Django tests with command: ['c:\\Users\\xxxxx\\Projects\\accounting\\env\\Scripts\\python.exe', 'C:\\Users\\xxxxx\\Projects\\accounting\\manage.py', 'test', '--testrunner=django_test_runner.CustomDiscoveryTestRunner', '-v', '-s', '.', '-p', '*test.py']

2025-04-18 11:48:34.236 [error] usage: manage.py test [-h] [--noinput] [--testrunner TESTRUNNER] [--failfast]
                      [-t TOP_LEVEL] [-p PATTERN] [--keepdb]
                      [--shuffle [SEED]] [-r] [--debug-mode] [-d]
                      [--parallel [N]] [--tag TAGS]
                      [--exclude-tag EXCLUDE_TAGS] [--pdb] [-b]
                      [--no-faulthandler] [--timing] [-k TEST_NAME_PATTERNS]
                      [--durations N] [--version] [-v {0,1,2,3}]
                      [--settings SETTINGS] [--pythonpath PYTHONPATH]
                      [--traceback] [--no-color] [--force-color]
                      [test_label ...]
manage.py test: error: argument -v/--verbosity: expected one argument

Django test discovery process exited with non-zero error code See stderr above for more details.

2025-04-18 11:48:34.237 [info]

Extension version: 2025.5.2025041601
VS Code version: Code 1.99.3 (17baf841131aa23349f217ca7c570c76ee87b957, 2025-04-15T23:18:46.076Z)
OS version: Windows_NT x64 10.0.26100
Modes:

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


envFile: "<placeholder>"

languageServer: "Pylance"

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

Installed Extensions
Extension Name Extension Id Version
andromeda Eli 1.8.2
auto-close-tag for 0.5.15
auto-rename-tag for 0.1.10
ayu tea 1.0.5
beardedicons Bea 1.18.0
beardedtheme Bea 10.0.0
better-comments aar 3.0.2
change-case wma 1.0.0
color-info bie 0.7.2
copilot Git 1.303.0
copilot-chat Git 0.26.5
Cyberpunk max 1.2.14
dbml-erd-visualizer boc 0.5.0
debugpy ms- 2025.6.0
deepdark-material Nim 3.3.1
dotenv mik 1.0.1
dynstat-midnight dyn 1.9.6
emoji Per 1.0.1
errorlens use 3.25.0
even-better-toml tam 0.21.2
explorer-exclude Pet 1.3.2
font-awesome-codes-html med 0.0.7
git-graph mhu 1.30.0
gitignore cod 0.10.0
hackthebox sil 0.2.9
henna htt 0.11.0
highlight-matching-tag vin 0.11.0
html-css-class-completion Zig 1.20.0
indent-nested-dictionary mge 0.0.4
intellicode-api-usage-examples Vis 0.2.9
intellij-idea-keybindings k-- 1.7.4
js-debug ms- 1.97.1
js-debug-companion ms- 1.1.3
json-tools eri 1.0.2
learn-with-sumit-theme Sum 11.1.0
live-server ms- 0.4.15
material-icon-theme PKi 5.21.2
monokai-plusplus dca 2.0.4
night-owl sdr 2.1.1
pdf tom 1.2.2
postman-for-vscode Pos 1.11.2
powershell ms- 2025.0.0
python ms- 2025.5.2025041601
python-docstring-highlighter rod 0.2.4
python-theme est 2.4.0
remote-explorer ms- 0.4.3
remote-ssh ms- 0.119.0
remote-ssh-edit ms- 0.87.0
ruff cha 2025.22.0
RunOnSave eme 0.2.7
selectline-statusbar tom 0.0.2
shades-of-purple ahm 7.3.2
sqltools mtx 0.28.4
sqltools-driver-mysql mtx 0.6.4
stats-bar njz 0.5.2
synthwave-vscode Rob 0.1.18
test-adapter-converter ms- 0.2.1
theme-bluloco-dark ulo 3.7.6
theme-dracula dra 2.25.1
theme-panda tin 1.4.0
tokyo-night enk 1.1.2
tokyo-panda-theme eff 1.12.0
vetur oct 0.37.3
vsc-python-indent Kev 1.21.0
vscode-ansi ili 1.1.7
vscode-commandbar gsp 0.3.1
vscode-commands fab 2.0.2
vscode-coverage-gutters rya 2.13.0
vscode-dbml mat 0.4.1
vscode-django bat 1.15.0
vscode-eslint dba 3.0.10
vscode-html-css ecm 2.0.13
vscode-intelephense-client bme 1.14.4
vscode-js-profile-table ms- 1.0.10
vscode-language-pack-fr MS- 1.99.2025041609
vscode-log-viewer ber 0.14.1
vscode-phpfmt kok 1.2.41
vscode-pylance ms- 2025.4.1
vscode-sort-json ric 1.20.0
vscode-sqlite ale 0.14.1
vscode-test-explorer hbe 2.22.1
vscode-yaml red 1.17.0
vscodeintellicode Vis 1.3.2
vue znc 0.12.0
xml Dot 2.5.1
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1260P (16 x 2496)
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) 31.70GB (12.40GB free)
Process Argv --crash-reporter-id 96bbfc2b-23da-4f22-8267-b6ead6cf47ab
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscod805:30301674
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31222730
e5gg6876:31282496
cp15370_t:31280197
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
31787653:31262186
3e8i5726:31271747
996jf627:31283433
usemplatestapi:31288272
7bj51361:31289155
747dc170:31275177
aj496949:31278748
aj953862:31281341

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 18, 2025
@eleanorjboyd
Copy link
Member

what are in the arguments in the setting for python. If you open your settings look for python.testing.unittest and there there might be an incorrect argument?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label May 27, 2025
@mygzi
Copy link

mygzi commented May 27, 2025

Not OP, but I observe this error specifically when python.testing.unittest is unspecified. Including the setting (e.g. as below) can be used to work around the error, presumably as it replaces the default arguments including -v.

    "python.testing.unittestArgs": [
        "-p",
        "*test*.py"
    ]

@eleanorjboyd
Copy link
Member

huh very interesting! I will give this a try on my end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants