-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
intial unit test and impl for ssh-keygen simulator #1432
base: master
Are you sure you want to change the base?
Conversation
* unit test that check-novalidate subcmd rejects * basic CLI impl for ssh-keygen simulator * trivial always fail impl of check-novalidate subcmd
Probably not worth merging yet since it doesn't actually to any check. So I've put it in draft mode. But good preview of what's to come soon so you can point out any improvements and changes that make sense. |
@jelmer Pick your poison: Soon I'm going to be adding a line of
from https://gitlab.com/perm.pub/hidos/-/blob/923691a51921de59250e80f7fd82fe40fa895637/hidos/sshsiglib/ssh_keygen.py#L1 And I think there are few other benefits. BUT if you think it's better to not |
Why do we need that? Dulwich is python >= 3.9, so annotations shouldn't require a "from future import" |
It is still needed for recursive/self-referential type hints. For instance, in the unquoted |
I'm usually in a container with Python 3.12 and the choice still is needed in 3.12. |
* strict mypy typing for ssh_keygen.py submodule * enable optional ability to double check against real ssh-keygen exec
tests/test_ssh_keygen.py
Outdated
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.
@jelmer You probably have a better idea than I do on the best way to handle this with unittest. This DOUBLE_CHECK_SSH_KEYGEN_SIMULATION flag will enable also running the real ssh-keygen
along with the main unit test, with the same test case input data, and make sure the exit return code is the same.
I'm thinking this double checking against the real ssh-keygen should be off by default. It's not really the point of the usual unittest. But it's also nice to sanity double check from time to time.
Makefile
Outdated
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.
@jelmer I wasn't sure the best way to handle this mypy strictness. Mypy seems to be pretty annoying in terms of selectively enable strict mode (it doesn't really seem to be possible). But I've written all the sshsiglib code passing under strict mode. So seems a pity to not try and keep it type strict.
Interesting ... I just discovered another benefit to using ruff requests using the |
* also add unit tests
@jelmer OK, this is an actual implementation of |
I figured I would just throw all the code in to one file, to keep it simple within the bigger picture of dulwich. However, there are a number of natural splits and layers to this implementation. This single file could naturally be split into multiple and placed within a subdirectory/submodule for all this sshsig/ssh_keygen stuff. |
trivial always fail impl of check-novalidate subcmd