Skip to content
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

TST/BF: enable overwriting downloads under Windows #5201

Merged
merged 2 commits into from Dec 4, 2020

Conversation

adswa
Copy link
Member

@adswa adswa commented Dec 3, 2020

This PR aims to fix a test failure that surfaced when a re-download attempts to overwrite an existing file (#5199 (comment)). On Windows systems, an os.rename() will always raise a FileExistsError
if the file exits, while on Unix systems the existing file is replaced silently if the user has permissions, see https://docs.python.org/3/library/os.html#os.rename.
os.replace() appears to be a cross-platform compatible solution, but let's hope that this doesn't break something else - then I could just do it if on_windows.

@adswa
Copy link
Member Author

adswa commented Dec 3, 2020

mental note: remove the known_failure_githubciwin annotation of test_HTTPDownloader_Basic and test_download_url if this fixes the error.

@adswa
Copy link
Member Author

adswa commented Dec 3, 2020

yay, the two tests in question (test_HTTPDownloader_Basic and test_download_url) now pass. I have removed the knownfailure annotation for the GH workflow and will see what happens

@codecov
Copy link

codecov bot commented Dec 3, 2020

Codecov Report

Merging #5201 (3a49df7) into maint (a92ec4c) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            maint    #5201      +/-   ##
==========================================
- Coverage   89.90%   89.90%   -0.01%     
==========================================
  Files         294      294              
  Lines       40953    40951       -2     
==========================================
- Hits        36820    36818       -2     
  Misses       4133     4133              
Impacted Files Coverage Δ
datalad/downloaders/tests/test_http.py 88.59% <ø> (-0.06%) ⬇️
datalad/downloaders/base.py 80.70% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a92ec4c...3a49df7. Read the comment docs.

@kyleam
Copy link
Collaborator

kyleam commented Dec 3, 2020

Thanks, @adswa. I wasn't aware of os.replace.

yay, the two tests in question (test_HTTPDownloader_Basic and test_download_url) now pass. I have removed the knownfailure annotation for the GH workflow and will see what happens

Hmm, do you mean by looking at the builds for this PR? I think we haven't had a windows build for the github ci since gh-4303.

@adswa
Copy link
Member Author

adswa commented Dec 3, 2020

Hmm, do you mean by looking at the builds for this PR? I think we haven't had a windows build for the github ci since gh-4303.

oh, that's a misconception of mine then, sorry. I thought that this would be the CrippledFS workflow. Shall I drop that commit (4a09de1)?

@kyleam
Copy link
Collaborator

kyleam commented Dec 3, 2020

I thought that this would be the CrippledFS workflow.

That's ubuntu with $TMPDIR pointing to a vfat fs (with the idea that that will reveal things like adjusted branch issues that aren't windows-specific).

Shall I drop that commit (4a09de1)?

Given it fixed these test failures on your end, I'd say it's fine to keep. If at some point a github ci windows build is re-enabled, we'll need assess where things stand anyway, so the worst case is that these two tests need to be marked up again.

@kyleam
Copy link
Collaborator

kyleam commented Dec 3, 2020

Any objections to moving this to maint?

@adswa
Copy link
Member Author

adswa commented Dec 3, 2020

Any objections to moving this to maint?

Not at all. I have to admit, I too rarely think of this in advance. I can rebase shortly, will just finish a commit on another branch

@adswa adswa changed the base branch from master to maint December 3, 2020 17:00
@kyleam
Copy link
Collaborator

kyleam commented Dec 3, 2020

@adswa I'm guessing the build failures are from a push followed by changing the base on github rather than the other way around. Triggering a new build (with a noop rewrite or a rebase to the latest maint) would hopefully sort it out. Sorry for the hassle.

On Windows systems, an os.rename will always raise a FileExistsError
if the file exits, while on Unix systems the existing file is replaced
silently if the user has permissions.
os.replace() appears to be a cross plattform compatible solution.
@adswa
Copy link
Member Author

adswa commented Dec 4, 2020

I have rebased to the latest maint

@kyleam kyleam merged commit 593d4ca into datalad:maint Dec 4, 2020
1 check passed
@yarikoptic yarikoptic added this to the 0.13.6 milestone Dec 12, 2020
@adswa adswa deleted the win-replace branch December 18, 2020 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants