pytest-dev / pytest-dev/pytest-xdist

Bug: -n Auto fails when run in WSL/VSCode Dev Container as part of pyproject.toml

Open
#997 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
287
Avg merge
9h 30m
Merged PRs (30d)
2

Description

I am working in WSL 2 in a VSCode Devcontainer, and when I run pytest-xdist with -n AUTO as part of pyproject.toml it fails with:

ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: argument -n/--numprocesses: invalid parse_numprocesses value: ' AUTO'

If I pass in an explicit number it runs fine. If I run from the command line pytest -n auto or poetry run pytest -n auto it runs just fine.

pyproject.toml

[tool.poetry.dependencies]
python = "^3.12"

[tool.poetry.group.dev.dependencies]
coverage = "^7.3.2"
ipykernel = "^6.26.0"
pyright = "^1.1.338"
Sphinx = "^7.2.6"
pytest-cov = "^4.1.0"
pytest-html = "^4.1.1"
pytest-xdist = "^3.5.0"

[tool.pytest.ini_options]
addopts = [
    "-n AUTO", # IF I comment out this line and add it to my own arguments it runs fine. IF I say -n 4 it runs fine.
    "--cov=/workspaces/coh/src/coh",
    "--cov-report=html",
    "--self-contained-html",
    "--html=/workspaces/coh/documentation/generated_reports/tests/test_result.html",
    "--cache-clear",
]

My kernel details I believe are:

Debian GNU/Linux 11 (bullseye) 
WSL 5.10.102.1-microsoft-standard-WSL2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the reported [tool.pytest.ini_options] addopts in pyproject.toml under WSL 2 or a VSCode Dev Container. Compare configuration parsing for "-n AUTO" with the working command-line forms; done means AUTO works from pyproject.toml without breaking explicit process counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.