Add alias --config-file to -c (#11036)

Fixes #11031

Signed-off-by: Chris Mahoney <chrismahoey@hotmail.com>
Co-authored-by: Chris Mahoney <chrismahoey@hotmail.com>
This commit is contained in:
Chris Mahoney
2023-05-26 20:56:18 +10:00
committed by GitHub
parent af124c7f21
commit 4f3f36c396
5 changed files with 19 additions and 4 deletions

View File

@@ -514,6 +514,8 @@ class TestConfigCmdlineParsing:
)
config = pytester.parseconfig("-c", "custom.ini")
assert config.getini("custom") == "1"
config = pytester.parseconfig("--config-file", "custom.ini")
assert config.getini("custom") == "1"
pytester.makefile(
".cfg",
@@ -524,6 +526,8 @@ class TestConfigCmdlineParsing:
)
config = pytester.parseconfig("-c", "custom_tool_pytest_section.cfg")
assert config.getini("custom") == "1"
config = pytester.parseconfig("--config-file", "custom_tool_pytest_section.cfg")
assert config.getini("custom") == "1"
pytester.makefile(
".toml",
@@ -536,6 +540,8 @@ class TestConfigCmdlineParsing:
)
config = pytester.parseconfig("-c", "custom.toml")
assert config.getini("custom") == "1"
config = pytester.parseconfig("--config-file", "custom.toml")
assert config.getini("custom") == "1"
def test_absolute_win32_path(self, pytester: Pytester) -> None:
temp_ini_file = pytester.makefile(
@@ -550,6 +556,8 @@ class TestConfigCmdlineParsing:
temp_ini_file_norm = normpath(str(temp_ini_file))
ret = pytest.main(["-c", temp_ini_file_norm])
assert ret == ExitCode.OK
ret = pytest.main(["--config-file", temp_ini_file_norm])
assert ret == ExitCode.OK
class TestConfigAPI:
@@ -1907,6 +1915,9 @@ class TestSetupCfg:
with pytest.raises(pytest.fail.Exception):
pytester.runpytest("-c", "custom.cfg")
with pytest.raises(pytest.fail.Exception):
pytester.runpytest("--config-file", "custom.cfg")
class TestPytestPluginsVariable:
def test_pytest_plugins_in_non_top_level_conftest_unsupported(