-
Notifications
You must be signed in to change notification settings - Fork 75
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 uri on pc #2923
Fix uri on pc #2923
Conversation
@@ -493,8 +493,7 @@ def download_uri_to_path(possible_uri, cache=None, local_path=os.curdir, timeout | |||
|
|||
if local_path is None: | |||
# if not specified, this is the default location: | |||
local_path = os.path.join(os.getcwd(), parsed_uri.path.split(os.path.sep)[-1]) | |||
|
|||
local_path = os.path.join(os.getcwd(), parsed_uri.path.split('/')[-1]) |
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.
Why was this not caught in CI? Is this not tested on Windows?
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 might see what went wrong now, thanks @javerbukh. @pllim – it looks like urllib's parse
method is for URLs and always uses /
. This is a block in the code where the parsed_uri.path
is parsed as a URL, which shouldn't be OS specific. Does that make sense?
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.
So, sounds like a new test needs to be added so this case is covered. And this new test should fail on main
but pass with this patch. Correct?
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.
Do we have a test already of loading data with a windows type path @pllim ? If not, do you have an example of setting up a test like that?
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.
Given that most of the devs work off OSX, probably not. Here's an idea:
- Find a small test that already use a data file (preferable not remote).
- When you detect the test is running on Windows, force forward slash, maybe like this:
str(p.absolute()).replace("/", "\\")
(pathlib hasas_posix()
but it does not use forward slash when I use git bash shell) - See if this fails on
main
. You want it to fail onmain
. - See if your patch fixes it.
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 tried that and it does now work, feel free to test on your own windows machines with pytest -s jdaviz/tests/test_utils.py --remote-data
.
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.
Jira ticket for adding remote data CI tests on Windows OS https://jira.stsci.edu/browse/JDAT-4596
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.
Should we just slap remote data on Windows job as part of this PR and take it back out when that other ticket is done?
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 look something like this: #2924
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.
Added that to the CI and it looks like it is fixed in this PR. Thank you for the example!
@javerbukh Just checking that this line should remain the same, since in this case the Line 480 in bc5dcbc
|
@bmorris3 I think you are correct that that should stay the same. |
@pllim You were correct that the CI should be throwing errors. I ran @bmorris3 , sorry, my first response to you was incorrect. That line does need to be changed. |
We could easily enable remote data on Windows job. But that does mean 2x server hit per run. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2923 +/- ##
=======================================
Coverage 88.79% 88.79%
=======================================
Files 111 111
Lines 17217 17217
=======================================
Hits 15288 15288
Misses 1929 1929 ☔ View full report in Codecov by Sentry. |
I'm not too worried about regression coverage since this would be very hard to sneak back in accidentally. But if we think there is more windows-specific remote data handling that should get coverage, then that may be worth it? 🤷♂️ Looks like URI support (#2875) was milestoned to 3.11, so maybe this should do the same and just be appended to that same changelog entry. |
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.
Windows CI is green even with remote data for this patch, so LGTM. Thanks!
Description
This pull request is to address a problem when loading data from a windows computer. The
os.path.sep
is different on a windows and linux computer, which does not work for our example notebooks.Fixes #
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.