Skip to content

Fix duplicate test id for pytest-9 - #269

Open
mgorny wants to merge 1 commit into
kbr:masterfrom
mgorny:pytest-fix
Open

Fix duplicate test id for pytest-9#269
mgorny wants to merge 1 commit into
kbr:masterfrom
mgorny:pytest-fix

Conversation

@mgorny

@mgorny mgorny commented Jul 8, 2026

Copy link
Copy Markdown

Running the test suite using pytest-9 yields the following error:

______________________________________ ERROR collecting fritzconnection/tests/test_core_utils.py ______________________________________
Duplicate parametrization IDs detected, but strict_parametrization_ids is set.

Test name:      fritzconnection/tests/test_core_utils.py::test_get_boolean_from_string
Parameters:     value, expected_result
Parameter sets: ['true', True], ['false', False], ['wahr', None], ['falsch', None], ['None', None], [42, None], ['', None], [None, None]
IDs:            true-True, false-False, wahr-None, falsch-None, None-None, 42-None, -None, None-None
Duplicates:     None-None

You can fix this problem using `@pytest.mark.parametrize(..., ids=...)` or `pytest.param(..., id=...)`.

This is because both "None" and None resolve to the same identifier. Override the identifier for the latter to fix the test suite.

Running the test suite using pytest-9 yields the following error:

```
______________________________________ ERROR collecting fritzconnection/tests/test_core_utils.py ______________________________________
Duplicate parametrization IDs detected, but strict_parametrization_ids is set.

Test name:      fritzconnection/tests/test_core_utils.py::test_get_boolean_from_string
Parameters:     value, expected_result
Parameter sets: ['true', True], ['false', False], ['wahr', None], ['falsch', None], ['None', None], [42, None], ['', None], [None, None]
IDs:            true-True, false-False, wahr-None, falsch-None, None-None, 42-None, -None, None-None
Duplicates:     None-None

You can fix this problem using `@pytest.mark.parametrize(..., ids=...)` or `pytest.param(..., id=...)`.
```

This is because both `"None"` and `None` resolve to the same identifier.
Override the identifier for the latter to fix the test suite.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
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 this pull request may close these issues.

1 participant