Skip to content

inconsistent parsing of addopts in toml #13903

@nedbat

Description

@nedbat

Using 8.4.2, I had this in my pyproject.toml:

[tool.pytest.ini_options]
addopts = "-q -n auto --dist=loadgroup -p no:legacypath --strict-markers --no-flaky-report -rfEX --failed-first"

Two of the options there take values: -n auto and -p no:legacypath. To get it to work with 9.0.0, I needed:

[tool.pytest]
addopts = [
    "-q",
    "-n=auto",
    "--dist=loadgroup",
    "-p no:legacypath",
    "--no-flaky-report",
    "-rfEX",
    "--failed-first",
]

The -n option needs an equals sign. If I use -n auto, I get:

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

But -p needs a space. If I used "-p=no:legacypath", I got this error:

ImportError: Error importing plugin "=no:legacypath": No module named '=no:legacypath'

Metadata

Metadata

Assignees

No one assigned

    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