Skip to content

python.testing.pytestArgs ignores multiple instances of the same arg #22999

@DScott-2

Description

@DScott-2

Type: Bug

Behaviour

Expected vs. Actual

This is a new issue that began appearing as of v2024.2

Expected:
pytestArgs which allow multiple of the same arg (e.g. --ignore=path/to/ignored/dir) pass all instances of the arg in the list to pytest
Actual:
Only the last instance of multiple args in the list are passed to pytest

Steps to reproduce:

  1. Modify the python.testing.pytestArgs setting with multiple --ignore=path options
  2. collect tests
  3. Only the last ignored path in python.testing.pytestArgs will be ignored

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.1
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Actual command: sent:

2024-02-29 12:03:43.223 [info] > ./shared/lib_ext/python/python.exe -m pytest -p vscode_pytest --collect-only . --ignore=./__temp__/ --basetemp=./__temp__
2024-02-29 12:03:43.224 [info] cwd: .
2024-02-29 12:03:43.868 [info] Discover tests for workspace name: pmu - uri: c:\Users\dscott2\source\pmu
2024-02-29 12:03:43.868 [info] Running discovery for pytest using the new test adapter.

Expected command sent:

2024-02-29 12:03:43.223 [info] > ./shared/lib_ext/python/python.exe -m pytest -p vscode_pytest --collect-only . --ignore=./web_ui/ --ignore=./__deploy__/ --ignore=./__temp__/ --basetemp=./__temp__

User Settings


languageServer: "Pylance"

testing
• cwd: "${workspaceFolder}"
• pytestArgs: [
".",
"--ignore=${workspaceFolder}/web_ui/",
"--ignore=${workspaceFolder}/__deploy__/",
"--ignore=${workspaceFolder}/__temp__/",
"--basetemp=${workspaceFolder}/__temp__/",
]
• pytestEnabled: true

Extension version: 2024.2.0
VS Code version: Code 1.86.1 (31c37ee8f63491495ac49e43b8544550fbae4533, 2024-02-07T09:08:20.941Z)
OS version: Windows_NT x64 10.0.19045
Modes:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions