-
Notifications
You must be signed in to change notification settings - Fork 3k
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
improve handling of file URIs #5892
improve handling of file URIs #5892
Conversation
1af2bfe
to
c7ef9d9
Compare
c7ef9d9
to
fe7584b
Compare
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 added some review comments.
Also, can the problem this PR is fixing be seen from the CLI? I think it would probably be good to have at least one higher-level regression test, especially since this function is a core function used throughout the code base. For that reason, I'm surprised it doesn't cause more problems. What must one do to hit this issue in real life?
tests/unit/test_download.py
Outdated
assert url_to_path('file://unc/as/path') == r'\\unc\as\path' | ||
assert url_to_path('file:c:/path/to/file') == r'C:\path\to\file' | ||
assert url_to_path('file://localhost/c:/tmp/file') == r'C:\tmp\file' |
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.
See my other ordering comment.
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 also think it would be nice if the test cases that are supposed to run on all platforms are broken out into a third test. That way there will be less repetition of test cases, and it's easier to see which cases are the same on both platforms.
@cjerdonek I think the change seems sound and the tests could be improved in an other PR. |
My preference would be for the review comments I made to be addressed with the PR. |
fe7584b
to
5cd50d2
Compare
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.
Some additional comments.
b1e2ed0
to
bb5c83f
Compare
@cjerdonek I think everything should now be fine ? |
Okay, thanks, @xavfernandez. I appreciate it. Now that I can see the tests more clearly, I have one more comment / question. For each file URI that appears in our test cases, shouldn't we have a test for it on both Windows and non-Windows? The reason I ask is that it doesn't seem like we can guarantee that a given file URI will only be seen on a given platform, so it seems like pip should be resilient in the face of such input, or at least we should have an understanding of / be able to see how it behaves in that case (even if that behavior is to error out). In other words, I agree the test expectation should be platform-dependent, but it seems like the test inputs should be run on both platforms. One way to do that would be to have a single test with parameters |
b079a47
to
b482b4b
Compare
bfdfdd6
to
8556b7f
Compare
ping @cjerdonek :) |
Thanks, looks great! By the way, I was just pinged about #6247 a couple hours ago. Do you know how this PR will affect that issue -- it looks like this means we won't be accepting on Unix systems what that poster is calling a relative file URI (will raise |
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.
Approving assuming you're okay with the implications for #6247. Thanks for picking this up, @xavfernandez!
For future reference, this seems related to this issue #783. Out of curiosity, does this PR solve an actual end-user issue, or is it more a matter of purity? The reason I ask is that I don't see an issue number referenced or description of a concrete use case. For example, even #783's latest comment says that it "seems to indicate that this is working now." |
(Btw, you should probably wait until after 19.0.3 is released before merging.) |
@cjerdonek it was more a matter of purity :) But FWIW it means that:
would now work :) |
Thanks @benoit-pierre for the initial PR and thanks @cjerdonek for the thorough review :) |
Thanks everyone who worked on this! |
Currently Opserver UT is failing in R3.2 branch because of following issues. 1. In latest release of pip, url_to_path handling has changed via pypa/pip#5892. This is breaking Opserver UT in R3.2. But It works in latest master. Fix - Make R3.2 opserver/Sconsript same as master. 2. Cassandra 2.1.9 is not spawning by mockcassandra. Fix - This cassandra version is affected by https://issues.apache.org/jira/browse/CASSANDRA-11661. Upgrade cassandra version to 2.2.12. This is same as cassandra version running on 3.2.13 deployments. Mockcassandra is using pycassa to connect to cassandra on thrift port. So, set start_rpc TRUE in cassandra yaml. Change-Id: I0d62d6a6487f284cc56bb904da6d5ba5ba191833 closes-jira-bug: CEM-5615
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
file://localhost/...
URIs, as per RFC 8089:file://localhost/some/path
is equivalent tofile:///some/path