Skip to content

Commit 1a37035

Browse files
committed
Add test test_absolute_win32_path
1 parent dd24256 commit 1a37035

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

_pytest/config.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ def _prepareconfig(args=None, plugins=None):
104104
elif not isinstance(args, (tuple, list)):
105105
if not isinstance(args, str):
106106
raise ValueError("not a string or argument list: %r" % (args,))
107-
if sys.platform == "win32":
108-
args = shlex.split(args, posix=False)
109-
else:
110-
args = shlex.split(args)
107+
args = shlex.split(args, posix=sys.platform == "win32")
111108
config = get_config()
112109
pluginmanager = config.pluginmanager
113110
try:

testing/test_config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_confcutdir(self, testdir):
7979
""")
8080
result = testdir.inline_run("--confcutdir=.")
8181
assert result.ret == 0
82-
82+
8383
class TestConfigCmdlineParsing:
8484
def test_parsing_again_fails(self, testdir):
8585
config = testdir.parseconfig()
@@ -101,6 +101,16 @@ def pytest_addoption(parser):
101101
config = testdir.parseconfig("-c", "custom.cfg")
102102
assert config.getini("custom") == "1"
103103

104+
def test_absolute_win32_path(self, testdir):
105+
temp_cfg_file = testdir.makefile(".cfg", custom="""
106+
[pytest]
107+
addopts = --version
108+
""")
109+
from os.path import normpath
110+
temp_cfg_file = normpath(str(temp_cfg_file))
111+
ret = pytest.main("-c " + temp_cfg_file)
112+
assert ret == _pytest.main.EXIT_OK
113+
104114
class TestConfigAPI:
105115
def test_config_trace(self, testdir):
106116
config = testdir.parseconfig()

0 commit comments

Comments
 (0)