From f738556caf3a57749488336ddf28dc48c8f4667b Mon Sep 17 00:00:00 2001 From: TanyaAgarwal28 <8979149361t@gmail.com> Date: Wed, 11 Oct 2023 11:03:50 +0530 Subject: [PATCH] Bug Fix 11282: config.getini returns an empty list for an option of type string absent in INI file --- src/_pytest/python.py | 9 +-------- testing/acceptance_test.py | 26 -------------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 0e9bd2126..cbb82e390 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1002,14 +1002,7 @@ class IdMaker: # Suffix non-unique IDs to make them unique. for index, id in enumerate(resolved_ids): if id_counts[id] > 1: - suffix = "" - if id[-1].isdigit(): - suffix = "_" - new_id = f"{id}{suffix}{id_suffixes[id]}" - while new_id in set(resolved_ids): - id_suffixes[id] += 1 - new_id = f"{id}{suffix}{id_suffixes[id]}" - resolved_ids[index] = new_id + resolved_ids[index] = f"{id}{id_suffixes[id]}" id_suffixes[id] += 1 return resolved_ids diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index d597311ae..7d1f0d5f9 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -341,32 +341,6 @@ class TestGeneralUsage: assert res.ret == 0 res.stdout.fnmatch_lines(["*1 passed*"]) - def test_direct_addressing_selects_duplicates(self, pytester: Pytester) -> None: - p = pytester.makepyfile( - """ - import pytest - - @pytest.mark.parametrize("a", [1, 2, 10, 11, 2, 1, 12, 11]) - def test_func(a): - pass - """ - ) - result = pytester.runpytest(p) - result.assert_outcomes(failed=0, passed=8) - - def test_direct_addressing_selects_duplicates_1(self, pytester: Pytester) -> None: - p = pytester.makepyfile( - """ - import pytest - - @pytest.mark.parametrize("a", [1, 2, 10, 11, 2, 1, 12, 1_1,2_1]) - def test_func(a): - pass - """ - ) - result = pytester.runpytest(p) - result.assert_outcomes(failed=0, passed=9) - def test_direct_addressing_selects_duplicates_2(self, pytester: Pytester) -> None: p = pytester.makepyfile( """