-
Notifications
You must be signed in to change notification settings - Fork 337
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 path list with whitespace #588
Fix path list with whitespace #588
Conversation
You haven't committed with your github account. You can fix this by doing the following
|
Thank you, I fixed it. |
@@ -226,6 +226,22 @@ def _data(self): | |||
finally: | |||
os.environ = old_environ | |||
|
|||
def test_7(self): |
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.
fails on linux (pathsep is :
)
"/home/foo bar/baz", | ||
r"/home/foo\ bar/baz" | ||
] | ||
os.environ["REZ_PACKAGES_PATH"] = os.pathsep.join(packages_path) |
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.
I think it is not a good idea to change an environment variable in the UT as it affects all other tests that are run as part of the same process (i.e when running rez selftests)
This line breaks a test on other unrelated area.
If you really need to, then put the original value back...something along the lines
original_packages_path = os.environ["REZ_PACKAGES_PATH"]
os.environ["REZ_PACKAGES_PATH"] = os.pathsep.join(packages_path)
self.assertEqual(c.packages_path, packages_path)
os.environ["REZ_PACKAGES_PATH"] = original_packages_path
or if you are going to use it several times create a @contextmanager
and with with ...
Also, I do not understand the original use case of this change.
Why not set the path like c:/foo;c:/bar/baz
or "/foo:baz/bar` why do you need the space?
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.
Agreed on not changing variables that persist across tests, however:
Why not set the path like c:/foo;c:/bar/baz or "/foo:baz/bar` why do you need the space?
The folder c:\foo bar\
is different from c:\foo
and c:\bar
I think.
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.
Would quotes work in this case? ie. "c:\foo bar"?
The packages path is split badly if a path contains whitespace.
If I set
REZ_PACKAGES_PATH
toc:/foo bar/baz
, rez will interpret it as["c:/foo", "bar/baz"]
.This PR fixes this issue. I also made a test to prove this.