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 tests/mypy error for "not WIN" condition #305

Merged
merged 3 commits into from
Jul 30, 2020

Conversation

krassowski
Copy link
Member

@krassowski krassowski commented Jul 29, 2020

@krassowski
Copy link
Member Author

Well, the implications are that we were NOT unit testing paths on Windows before...

@krassowski
Copy link
Member Author

We have the following errors:

>       assert normalized_uri(root_dir) == expected_root_uri
E       AssertionError: assert 'file://vboxsvr/shared-folder/' == 'file://vboxsvr/shared-folder'
E         - file://vboxsvr/shared-folder
E         + file://vboxsvr/shared-folder/
E         ?                             +
>       assert file_uri_to_path(file_uri) == expected_windows_path
E       AssertionError: assert 'C:/Windows/System32/Drivers/etc' == 'C:\\Windows\\System32\\Drivers\\etc'
E         - C:\Windows\System32\Drivers\etc
E         ?   ^       ^        ^       ^
E         + C:/Windows/System32/Drivers/etc
E         ?   ^       ^        ^       ^
>       assert file_uri_to_path(file_uri) == expected_windows_path
E       AssertionError: assert 'C:/some dir/some file.txt' == 'C:\\some dir\\some file.txt'
E         - C:\some dir\some file.txt
E         ?   ^        ^
E         + C:/some dir/some file.txt
E         ?   ^        ^

Not quite sure if it's our expectations that are incorrect, or if the implementation is wrong.

@bollwyvl
Copy link
Collaborator

Indeed... i need to take a look back through what prompted us to have to take these measures. I look forward to next month when we can drop 3.5, and use pathlib for many of these things.

@bollwyvl
Copy link
Collaborator

Sorry I didn't get to responding to this until now!

I think if the implementation was wrong, we'd be seeing more failures downstream (e.g. Foreign extractors.ipynb). I guess we could also force CI to do stuff on a different drive (there's a D: and C: on azure), and muck up the path with more strings.

Given the intent of normalized_uri, it's safe to just add the missing / for test_normalize_windows_path_case. Everywhere we use URIs, now, I'm pretty sure we're using a proper URI manipulation function, so whatever it's doing is right.

Turns out the slashes in test_file_uri_to_path_windows are also correct, as we're not doing anything path-related with them, just URL stuff, and so / should be expected. So those slashes can just be reversed in the expected, and the r taken off the front.

So yeah: just bad expectations, and boo on me for trying to be cute with ~.

@krassowski krassowski merged commit 9688a1c into master Jul 30, 2020
@bollwyvl
Copy link
Collaborator

bollwyvl commented Jul 30, 2020 via email

@krassowski krassowski deleted the fix/negation_in_test_paths branch September 4, 2020 16:19
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.

2 participants