-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix a small issue about shlex.split not working well with win32 path #1523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -104,7 +104,10 @@ def _prepareconfig(args=None, plugins=None): | |||
elif not isinstance(args, (tuple, list)): | |||
if not isinstance(args, str): | |||
raise ValueError("not a string or argument list: %r" % (args,)) | |||
args = shlex.split(args) | |||
if sys.platform == "win32": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about just using shlex.split(args, posix=sys.platform == "win32")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RonnyPfannschmidt of course meant shlex.split(args, posix=sys.platform != 'win32')
. 😉
good find, for platform-quicks, tests are necessary, since its easy to miss reasons and implementation details @nicoddemus please have a quick look |
@RonnyPfannschmidt sure, will do it on my lunch break later. 😁 |
Looks good, except for lack of tests as @RonnyPfannschmidt mentioned. 😁 Thanks @MengJueM for the work! |
@RonnyPfannschmidt @nicoddemus One test is added. |
@MengJueM while the change is small, I think it is worth a mention in the changelog... I'm sure more people has been bitten by it, so a changelog entry will help raise awareness that this has been fixed. 😁 Thanks again for the work! |
@nicoddemus Changelog is added. I was getting impressed about the good quality and coverage when I started to review the testing cases of pytest. Thanks for your guys maintaining such a perfect project. Pytest is amazing. |
Thanks, we do appreciate your compliment and the effort on the PR! 😄 |
This fixes the bug inserted by accident in pytest-dev#1523
Thanks for submitting a PR, your contribution is really appreciated!
Here's a quick checklist that should be present in PRs:
AUTHORS
(done)CHANGELOG
(done)Issue description:
Under
win32
machine:Look at the
shlex.split
signature:the
posix
default value isTrue
, once I passed awin32
path (e.x.D:\tests\pytest.ini
) intoshlex.split
, it will output asDtestspytest.ini
. This PR will check the platform firstly before applying thewin32
path intoshlex.split
.