-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix DeprecationWarning: invalid escape sequence in tests #3426
Conversation
Signed-off-by: Mickaël Schoentgen <[email protected]>
Do you mind link the output of our CI which has this warning? I didn't find our passed Azure CI in windows/linux has these kind of warnings. Thanks! |
Oooh I know exactly what this refers to. I would prefer raw strings for this fix though, if you don’t mind! |
@@ -218,7 +218,7 @@ def mock_version(path): | |||
@pytest.mark.windows | |||
@pytest.mark.skipif(os.name != "nt", reason="Windows test only") | |||
def test_windows_shellquote(self): | |||
test_path = "C:\Program Files\Python36\python.exe" | |||
test_path = r"C:\Program Files\Python36\python.exe" |
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.
Based on the presence of 4 backslashes in the original, I'm guessing you'd need 2 backslashes in a raw string and then this should work
The issue
Fixes
DeprecationWarning: invlid escape sequence
in tests.The fix
Use double backslashes (raw strings would have been OK too).
The checklist
news/
directory to describe this fix with the extension.bugfix
,.feature
,.behavior
,.doc
..vendor
. or.trivial
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.I do not think adding a NEWs entry is necessary but correct me if I am wrong :)