The following test fails when the test suite of click-8.4.0 is run with -Wdefault:
$ pytest -Wdefault tests/test_options.py::test_flag_group_competition_duplicate_option_name
========================================================= test session starts =========================================================
platform linux -- Python 3.13.13, pytest-9.0.3, pluggy-1.6.0
rootdir: /tmp/click-8.4.0
configfile: pyproject.toml
collected 1 item
tests/test_options.py F [100%]
============================================================== FAILURES ===============================================================
__________________________________________ test_flag_group_competition_duplicate_option_name __________________________________________
runner = <click.testing.CliRunner object at 0x7fa0db07e660>
def test_flag_group_competition_duplicate_option_name(runner):
"""The same option name declared twice on the same command is a user
error.
"""
@click.command()
@click.option("--xyz", default="first")
@click.option("--xyz", default="second")
def cli(xyz):
click.echo(repr(xyz), nl=False)
result = runner.invoke(cli, [])
> assert result.exit_code == 1
E assert 0 == 1
E + where 0 = <Result okay>.exit_code
tests/test_options.py:3248: AssertionError
========================================================== warnings summary ===========================================================
tests/test_options.py::test_flag_group_competition_duplicate_option_name
/tmp/click-8.4.0/src/click/core.py:1262: UserWarning: The parameter --xyz is used more than once. Remove its duplicate as parameters should be unique.
parser = self.make_parser(ctx)
tests/test_options.py::test_flag_group_competition_duplicate_option_name
/tmp/click-8.4.0/src/click/core.py:1255: UserWarning: The parameter --xyz is used more than once. Remove its duplicate as parameters should be unique.
self.parse_args(ctx, args)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= short test summary info =======================================================
FAILED tests/test_options.py::test_flag_group_competition_duplicate_option_name - assert 0 == 1
==================================================== 1 failed, 2 warnings in 0.13s ====================================================
We are running tests with -Wdefault, since it is important that they don't regress over unrelated warnings. If they expect a warning, they should check for a warning rather than rely on the pytest invocation implicitly turning warnings into exceptions.
Environment:
- Python version: 3.13.13
- Click version: 8.4.0
The following test fails when the test suite of click-8.4.0 is run with
-Wdefault:We are running tests with
-Wdefault, since it is important that they don't regress over unrelated warnings. If they expect a warning, they should check for a warning rather than rely on the pytest invocation implicitly turning warnings into exceptions.Environment: