Fix Failing Tests on Windows (WIP)
This is in line with #8
I'm working on getting the test cases to pass for Windows.
Upon installation, 6 of the 70 existing tests were failing. Here's a short summary of them:
=================================================== short test summary info ===================================================
FAILED test/test_open.py::TestSafer::test_file_perms - AssertionError: -rw-rw-rw-
FAILED test/test_open.py::TestSafer::test_symlink_directory - OSError: [WinError 1314] A required privilege is not held by the client: 'sub' -> 'sub.sym'
FAILED test/test_open.py::TestSafer::test_symlink_file - OSError: [WinError 1314] A required privilege is not held by the client: 'one' -> 'one.sym'
FAILED test/test_open.py::TestSafer::test_tempfile_perms - assert 33206 in (33188, 33204)
FAILED test/test_writer.py::test_wrapper_bug2 - PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\...
FAILED test/test_writer.py::test_wrapper_bug3 - PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\...
Fixed tests
- [x] test_file_perms
- [x] test_symlink_directory
- [x] test_symlink_file
- [x] test_temlpfile_perms
- [x] test_wrapper_bug2
- [x] test_wrapper_bug3
Summary by Sourcery
Bug Fixes:
- Fix the test_file_perms test to handle file permission checks correctly on Windows by adjusting the logic to account for Windows-specific file handling.
Reviewer's Guide by Sourcery
This pull request addresses failing tests on Windows platforms, focusing on file permission and symlink-related issues. The changes primarily involve modifying the test suite to account for differences in file handling between UNIX and Windows systems.
No diagrams generated as the changes look simple and do not need a visual representation.
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Modify file permission checks in test cases to accommodate Windows |
|
test/test_open.py |
| Address symlink-related test failures on Windows |
|
test/test_open.py |
| Investigate file access issues in wrapper-related tests |
|
test/test_writer.py |
Tips and commands
Interacting with Sourcery
-
Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it.
-
Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. -
Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted.
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
@rec The symlink directory and files tests will work only on the condition that the tests are being run in a terminal that contains admin privileges. Unfortunately, admin privileges are not given to terminals by default (but can be changed). I set the test to skip for Windows if admin privileges are not given (instead of failing), but they will pass if given (or will fail if the source of errors is not from privileges).
Looks good for another round of reviews
PS: I'll look deeper into the Windows-y command.
So it's very natural to demonstrate that you comprehend and are keeping up, but a magic secret to appearing to be a more senior programmer is only talking about operative or actionable questions.
Overall, you don't need to respond to comments if you agree with them, or say what you are going to do, unless there's a question! :-D (Also, you should use the review feature to group together comments in one email, not that it's a big deal, particularly with such a small project.)
Computer programming is a very noisy occupation so I spend extra care in only sending people messages which are actionable, i.e., ask them to do something, or ask a question, or give them information they asked for.
Otherwise, people simply miss stuff in the traffic.
This also leaves more time for actual chat. 🔈
As I said, it's extremely natural, so don't think it's some sort of sin. Mostly you discover this somewhat later, when you have multiple junior programmers each trying to out-volume the other in progress reports... 😈
@rec A pending workflow approval
Voila: https://github.com/rec/safer/pull/28
I'll add you as a reviewer once you've accepted my invitation on this repo...