-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
grass.jupyter: Fix session tests on Windows #4368
Conversation
7b42da0
to
1554e3b
Compare
The interpolated path strings aren't escaped when evaluated, so using a raw string allows C:\Users to not have an invalid \U escape sequence.
1554e3b
to
5b46b84
Compare
The diff is okay, but I find this hard to believe and would prefer the original, simpler code. Can you provide a code example or an article? I can't find or reproduce anything myself. |
It is quite simple, as the alternative is to find a way to re-escape the string from an evaluated path. Take a look at a run on main, the script that is saved and executed doesn't have the backslashes escaped anymore, since it was evaluated when the file was written from a string. https://github.com/OSGeo/grass/actions/runs/10992700384/job/30517619655#step:12:857
From the next test (but we can see the equivalent way up), the tmp_path fixture is given as a pathlib Path, like:
At the next test, we also see what an escaped path would look like:
|
Note that the script here is just a string, that is then called, its not Python code yet.. |
That's the part I missed! Thanks for pointing that out. |
The interpolated path strings aren't escaped when evaluated, so using a raw string allows C:\Users to not have an invalid \U escape sequence.