-
Notifications
You must be signed in to change notification settings - Fork 308
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
test_api: Normalize file name and path #608
test_api: Normalize file name and path #608
Conversation
test_list_notebooks was failing on file systems with unicode normalization different from the encoding used in the strings. In particular on macOS with HFS+ I got failures for four of the file names. This is because HFS+ uses normalization form D while normalization form C is more commonly used, especially on Linux. By normalizing the name and path read from disk to NFC we avoid the mismatch as long as no NFD strings are added to the `dirs` tuples. There are other unicode normal forms and normalization is not necessarily invertible so this is not a perfect solution. I can think of two alternative solutions: 1. Refrain from using any unicode symbols that have different representations in the various normal forms. 2. Write temporary files to disk somewhere, the read back the paths and filenames and use those instead of the original strings in the test.
Thanks for submitting your first pull request! You are awesome! 🤗 |
(There was no PR template to follow.) |
Codecov Report
@@ Coverage Diff @@
## master #608 +/- ##
==========================================
- Coverage 77.41% 77.36% -0.06%
==========================================
Files 110 110
Lines 10252 10253 +1
Branches 1259 1259
==========================================
- Hits 7937 7932 -5
- Misses 1918 1926 +8
+ Partials 397 395 -2
Continue to review full report at Codecov.
|
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.
Thank you!
test_list_notebooks was failing on file systems with unicode
normalization different from the encoding used in the strings. In particular on macOS with HFS+ I got failures for four of the file names. This is because HFS+ uses normalization form D while normalization form C is more commonly used, especially on Linux.
By normalizing the name and path read from disk to NFC we avoid the mismatch as long as no NFD strings are added to the
dirs
tuples. There are other unicode normal forms and normalization is not necessarily invertible so this is not a perfect solution.I can think of two alternative solutions: