forked from sigstore/model-transparency
-
Notifications
You must be signed in to change notification settings - Fork 0
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/signature lints #5
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Martin Sablotny <msablotny@nvidia.com>
Signed-off-by: Martin Sablotny <msablotny@nvidia.com>
susperius
force-pushed
the
fix/signature-lints
branch
from
July 24, 2024 16:32
3b94397
to
31008b9
Compare
susperius
pushed a commit
that referenced
this pull request
Aug 20, 2024
* Configure coverage reporting By default, `hatch test -c` coverage report lists only counts of lines and lines missing and percentages but there is no way to see which are the ones that are missing. We don't have an option to generate an html report at the moment (pypa/hatch#1477). Added some options to display missing lines. Also, by default, all files are included in the report, including tests (covering the test-only code). I removed the tests, but if we decide we should add them that's easy to do. More importantly, the report lists files that are 100% covered (not useful in CI) and empty files (not useful at all). So, I removed those from the output. There is another bigger issue that only files that are imported by a test get reported, so if we have code that is not tested at all it will not show up here. We already have such code in `signature/` and `signing/sigstore.py`. Fixing this will be left for later. Current output is: ``` Name Stmts Miss Cover Missing -------------------------------------------------------------------------- src/model_signing/signing/in_toto.py 168 68 60% 65-78, 181-190, 342-367, 485-512, 660-671, 793-806 -------------------------------------------------------------------------- TOTAL 745 70 91% ``` Fixing the missing coverage is left for later. We should aim for 95%+ or so coverage, I think. We should probably make it so that GitHub reports this table back on PRs, so reviewers can quickly ask for more testing without needing to check the GHA report. Punted for later, for now I'll just remember to just keep checking. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com> * Add unit tests for signing with sigstore. We need to do quite a lot of mocking around Sigstore, but we are able to test all logic in our library. What is left to do for testing is e2e integration tests (#5) and testing with signing on one OS and verifying on another (sigstore#25). Both of these are integration style tests and we will only be able to run them in GHA. I'll send a PR for those soon. While testing, I discovered some minor bugs with error reporting and one moderate bug. Fixed in this PR. We now have achieved 100% test coverage! 🎉 ``` Name Stmts Miss Cover Missing ------------------------------------- TOTAL 835 0 100% ``` Well, almost. There are 2 files that are not imported by tests at all, so they don't get included in the report: ``` src/model_signing/signature/fake.py src/model_signing/signature/pki.py ``` This depends on sigstore#287 which configures the coverage reporting. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com> --------- Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
susperius
pushed a commit
that referenced
this pull request
Aug 21, 2024
* Configure coverage reporting By default, `hatch test -c` coverage report lists only counts of lines and lines missing and percentages but there is no way to see which are the ones that are missing. We don't have an option to generate an html report at the moment (pypa/hatch#1477). Added some options to display missing lines. Also, by default, all files are included in the report, including tests (covering the test-only code). I removed the tests, but if we decide we should add them that's easy to do. More importantly, the report lists files that are 100% covered (not useful in CI) and empty files (not useful at all). So, I removed those from the output. There is another bigger issue that only files that are imported by a test get reported, so if we have code that is not tested at all it will not show up here. We already have such code in `signature/` and `signing/sigstore.py`. Fixing this will be left for later. Current output is: ``` Name Stmts Miss Cover Missing -------------------------------------------------------------------------- src/model_signing/signing/in_toto.py 168 68 60% 65-78, 181-190, 342-367, 485-512, 660-671, 793-806 -------------------------------------------------------------------------- TOTAL 745 70 91% ``` Fixing the missing coverage is left for later. We should aim for 95%+ or so coverage, I think. We should probably make it so that GitHub reports this table back on PRs, so reviewers can quickly ask for more testing without needing to check the GHA report. Punted for later, for now I'll just remember to just keep checking. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com> * Add unit tests for signing with sigstore. We need to do quite a lot of mocking around Sigstore, but we are able to test all logic in our library. What is left to do for testing is e2e integration tests (#5) and testing with signing on one OS and verifying on another (sigstore#25). Both of these are integration style tests and we will only be able to run them in GHA. I'll send a PR for those soon. While testing, I discovered some minor bugs with error reporting and one moderate bug. Fixed in this PR. We now have achieved 100% test coverage! 🎉 ``` Name Stmts Miss Cover Missing ------------------------------------- TOTAL 835 0 100% ``` Well, almost. There are 2 files that are not imported by tests at all, so they don't get included in the report: ``` src/model_signing/signature/fake.py src/model_signing/signature/pki.py ``` This depends on sigstore#287 which configures the coverage reporting. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com> --------- Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
linting