Skip to content
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

[FYI] Pytest have "weak recommendation" on addopts to be a string #465

Closed
abravalheri opened this issue Aug 8, 2024 · 2 comments · Fixed by #468
Closed

[FYI] Pytest have "weak recommendation" on addopts to be a string #465

abravalheri opened this issue Aug 8, 2024 · 2 comments · Fixed by #468

Comments

@abravalheri
Copy link
Contributor

As per the discussion in pytest-dev/pytest#12228, it seems that pytest recommends the addopts setting to be a string (although that is pretty much a temporary hack due to transitory nature of tool.pytest.ini_options).

addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]

@henryiii
Copy link
Collaborator

henryiii commented Aug 8, 2024

I don't gather that from the discussion. The person who suggested it be a string also suggested it not be in pyproject.toml. Since this isn't supported:

[tool.pytest.ini_options]
addopts = """
    # show 10 slowest invocations:
    --durations=10

    # a bit of verbosity doesn't hurt:
    -v
"""

but this is:

[tool.pytest.ini_options]
addopts = [
    # show 10 slowest invocations:
    "--durations=10",

    # a bit of verbosity doesn't hurt:
    "-v",
]

I'd say it's significantly better to have it as a list of strings.

transitory nature

It's been several years now.

@henryiii
Copy link
Collaborator

henryiii commented Aug 8, 2024

I am fine to fix the repo-review check to support a string here, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants