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

Fix issue #417: replace os.rename #418

Merged
merged 1 commit into from Sep 2, 2020

Conversation

manthonyaiello
Copy link
Contributor

Instances of os.rename in e3 are replaced to use e3.fs.mv, which was
itself written to replace shutil.move.

Note that in e3.fs.mv, the uses of os.rename are retained. Quick
testing suggests that these uses do not cause problems, and the error
behavior of os.rename is sufficiently different from shutil.move
that I am reluctant to change these uses.

In the test case for e3.fs, the use of os.rename is replaced with
shutil.move - it seemed self-serving to use e3.fs.mv here.

Finally, in fix-coverage-paths, the use of os.rename is replaced with
shutil.move. This script doesn't import e3 at all, so sticking with
python libraries seemed best.

@manthonyaiello
Copy link
Contributor Author

CI failed running black for files I didn't modify. This is odd:

  1. it passed locally when I ran both pre-commit and tox
  2. it’s failing on files I didn’t touch
  3. the way it’s failing is particularly bizarre — it’s like black is trying to actually edit the file, even though it’s supposed to be running in --diff --check mode

Let me know what you want me to do about this (if anything)

@manthonyaiello
Copy link
Contributor Author

manthonyaiello commented Sep 1, 2020

Number (1) is because of a different black version, I think. Locally, I was running with black 19.10b0; the latest black is 21.0b0

Number (3) above (which reports in the log as "I/O operation on closed file") is a reported issue on black: psf/black#1664

I'm struggling understand why black changed the formatting for these files at all. In the case of archive.py, it reformatted 2/5 lines that were longer than 79 characters — but the two reformatted lines are 87 characters long (prior to reformatting), which it should have left alone. This feels like a black bug.

Perhaps we should be freezing the version of black we use for checking style? E.g., 19.10b0 certainly works (matches the current formatting and doesn't block up with the I/O operation error).

@enzbang
Copy link
Member

enzbang commented Sep 2, 2020

Perhaps we should be freezing the version of black we use for checking style? E.g., 19.10b0 certainly works (matches the current formatting and doesn't block up with the I/O operation error).

We're trying to follow the latest versions of all dependencies in the GitHub CI, this allow us to quickly detect potential issues way before we deploy in production. In that case, I have freeze to 19.10b0 to avoid these annoying regressions. We'll try again to remove that constraint once those issues are fixed.

Instances of `os.rename` in e3 are replaced to use `e3.fs.mv`, which was
itself written to replace `shutil.move`.

Note that in `e3.fs.mv`, the uses of `os.rename` are retained. Quick
testing suggests that these uses do not cause problems, and the error
behavior of `os.rename` is sufficiently different from `shutil.move`
that I am reluctant to change these uses.

In the test case for `e3.fs`, the use of `os.rename` is replaced with
`shutil.move` - it seemed self-serving to use `e3.fs.mv` here.

Finally, in fix-coverage-paths, the use of `os.rename` is replaced with
`shutil.move`. This script doesn't import e3 at all, so sticking with
python libraries seemed best.
@codecov
Copy link

codecov bot commented Sep 2, 2020

Codecov Report

Merging #418 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #418   +/-   ##
=======================================
  Coverage   95.94%   95.94%           
=======================================
  Files          79       79           
  Lines        6334     6335    +1     
=======================================
+ Hits         6077     6078    +1     
  Misses        257      257           
Impacted Files Coverage Δ
src/e3/anod/sandbox/migrate.py 95.12% <100.00%> (+0.12%) ⬆️
src/e3/store/cache/backends/filecache.py 100.00% <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 8b8cb62...fe11aa7. Read the comment docs.

@enzbang enzbang merged commit 8017dc8 into AdaCore:master Sep 2, 2020
@manthonyaiello manthonyaiello deleted the feature/fix-#417 branch September 2, 2020 12:21
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

2 participants