-
Notifications
You must be signed in to change notification settings - Fork 83
add tests #86
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
base: main
Are you sure you want to change the base?
add tests #86
Conversation
|
This is an AMAZING initiative, thank you so much! A few answers / guidelines:
|
|
Thanks for your answer and glad you like it! I'll test it with the Linux Kernel now and let you know, my guess is also that this is solved with using The The pythonic way would be to have a main function and a stub which calls the script, but this all also seems to be an overkill. |
|
Thanks for the suggestion, it seems that merge commits with renames still require this. For example this commit: torvalds/linux@1a9239b Even github seems to have some trouble showing this commit 😄 I'll see if I can create a small test scenario for this. |
|
Okay, it was pretty simple; just add something in a merge bubble. I also added some tests for when the worktree is dirty (and force). Now the coverage is: I guess also some Windows and NetBSD tests would be nice, but I'd rather do that another time (in another PR). Do you think these tests should also be run for CI in a GitHub Action? |
git-restore-mtime
Outdated
| # Otherwise, ignore any dirty files | ||
| else: | ||
| dirty = set(git.ls_dirty()) | ||
| print(dirty) |
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.
Intentional or debug leftover?
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.
whups, removed in 6354f4e
Executables in *nix tend not to have extensions (or underscores). Many python projects get away with this by having a (usually shell) wrapper script that simply calls To mitigate that and ease development I keep a local As for the module-level initialization, it's basically the command-line parsing and subsequent function reassignments based on it. And yeah, it can see how this makes argument mocking very hard, sorry. Well, one could move all this to the beginning of main, but that would require a few Those, along with a more friendly |
|
It's great to read your open minded to changes to the current script to improve testability! I'm not sure what's best, I really like the current simplicity. I give it some thoughts. |
Hi! I noticed #48 and thought I could help.
It was quite a challenge (as the Python scripts prevent loading as a module) but I think this could work.
You can run this test using:
I only have some trouble with the last test (
test_missing), I cannot trigger theargs.missingif condition.Do you remember how to cover/reproduce this scenario?
This is stilll work in progress and I'd love to hear your feedback. I tried hard to be able to get code coverage, if you don't care about that it might be simpler not to use pytest and rewrite this into a simple test script.
I now focused on
git-restore-mtimebut this can (and should) be extended to the other scripts.