From e07b993aca63cebf980a95296576817bfe7b658e Mon Sep 17 00:00:00 2001 From: TanyaAgarwal28 <8979149361t@gmail.com> Date: Wed, 11 Oct 2023 12:59:02 +0530 Subject: [PATCH] Bug Fix 11282: config.getini returns an empty list for an option of type string absent in INI file --- testing/test_conftest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/test_conftest.py b/testing/test_conftest.py index 058b40c58..ca97b2611 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -224,6 +224,7 @@ def test_setinitial_conftest_subdirs(pytester: Pytester, name: str) -> None: def test_my_option(pytester: Pytester): testdir = pytester.mkdir("test_my_option") conftest_content = """ + import pytest def pytest_addoption(parser): parser.addini( "my_option", @@ -231,6 +232,9 @@ def test_my_option(pytester: Pytester): default=None, help="My option", ) + @pytest.fixture(scope='session') + def my_option(request): + return request.config.getini("my_option") """ testdir.joinpath("conftest.py").write_text(conftest_content, encoding="utf-8") # Create a simple test function