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

Pathlib everywhere #125

Merged
merged 11 commits into from
Jan 19, 2024
Merged

Pathlib everywhere #125

merged 11 commits into from
Jan 19, 2024

Conversation

gforcada
Copy link
Collaborator

While looking at the code I noticed that we were using plenty of os.sep and os.path.join that since Python 3.4 is so much more nicer to use pathlib.Path instead.

The diff turned out quite big, but it's only about replacing old with new usages, no functionality changes.

As an extra bonus there are a couple of minor improvements added 😄

@gforcada
Copy link
Collaborator Author

Interestingly, on all python versions works but on 3.10 🤷🏾

@reinout
Copy link
Owner

reinout commented Dec 23, 2023

The 3.10 error is caused by python/cpython#88227
Though.... I mis-looked and took 3.8.10 to be 3.10. It looks similar, though.

@coveralls
Copy link

coveralls commented Dec 28, 2023

Coverage Status

coverage: 99.967% (-0.001%) from 99.968%
when pulling b2acd51 on pathlib-everywhere
into 131da6a on master.

@reinout
Copy link
Owner

reinout commented Dec 28, 2023

3.10 is still a problem. Weird. Looks like the bug I mentioned.
Barbaric idea: remove 3.10 from the test? We're testing 3.9 and 3.11, if those two work...

@gforcada gforcada force-pushed the pathlib-everywhere branch 2 times, most recently from 4129319 to 5d5301a Compare December 28, 2023 10:11
The file
`src/Products/CMFCore/tests/fake_skins/fake_skin/test_text_latin1.txt`
in `Products.CMFCore` breaks while trying to read it with a Unicode
error.

Rather than breaking, at least report about it.
@gforcada
Copy link
Collaborator Author

Yes, we could do that indeed, maybe with a big disclaimer, or directly a sys.exit(1) if the user tries to run it on Python 3.10? 🤔

@reinout
Copy link
Owner

reinout commented Jan 15, 2024

Hm, I updated the PR from master as I wanted to get the update to the "setup-python" action merged. But it also grabbed some other changes from master. Anyway, I see it still fails on 3.10.

@reinout
Copy link
Owner

reinout commented Jan 15, 2024

I've removed 3.10 from the tests and added a note to the changelog. I assume most people using this tool use a more recent python version. And otherwise they'll probably look at the changelog when they see a sudden error.

@reinout
Copy link
Owner

reinout commented Jan 15, 2024

@gforcada , I did some mocking in 582fd4f, can you check that?

Weird, I must have done something wrong, as the code isn't reached?? Anyway, I'm off home to dinner :-)

@reinout
Copy link
Owner

reinout commented Jan 16, 2024

Coverage went down 0.001% because we removed a few lines somewhere. Failing on that is too restrictive to my taste, so I've set the threshold for going down to a generous 0.5% :-)

@gforcada, if you're happy with my mucking-about with the tests, you can merge it.

@gforcada gforcada merged commit 812d2c1 into master Jan 19, 2024
6 checks passed
@gforcada gforcada deleted the pathlib-everywhere branch January 19, 2024 16:38
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