-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add contribution_utils to license_utils for more complete unit testing #271
Merged
netsettler
merged 17 commits into
kmp_license_utils
from
kmp_license_and_contribution_utils
Jul 28, 2023
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f1d2958
Add contribution_utils.
netsettler 01df254
Add a CONTRIBUTORS.json
netsettler 7c2e9ce
Add some coverage tests.
netsettler f64cb65
Additional test coverage.
netsettler 7fa5ad4
Test coverage.
netsettler 8d52b69
Coverage for script file.
netsettler 95b6e37
Testing of qa_checkers.
netsettler 0694187
More coverage
netsettler 2f715a4
More test coverage.
netsettler c8b3e8d
Refactor for easier testing. Add some test coverage.
netsettler fde4598
PEP8. Suppress a warning.
netsettler e1d03ad
Fix a broken test.
netsettler ec028c2
PEP8
netsettler 663616f
More test coverage.
netsettler 902f5c6
Update to use python system logger in license_utils
netsettler 24276de
Some tweaks based on beta trials in snovault.
netsettler 6b62ec8
Bump beta version.
netsettler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
{ | ||
"forked_at": "2017-11-27T11:53:17-05:00", | ||
"excluded_fork": null, | ||
"pre_fork_contributors_by_name": null, | ||
"contributors_by_name": { | ||
"Alex Balashov": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Alex Balashov", | ||
"Alexander Balashov" | ||
] | ||
}, | ||
"Alexander Veit": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Alexander Veit" | ||
] | ||
}, | ||
"Andrea Cosolo": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Andrea Cosolo" | ||
] | ||
}, | ||
"Andy Schroeder": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Andy Schroeder", | ||
"aschroed" | ||
] | ||
}, | ||
"Carl Vitzthum": { | ||
"emails": [ | ||
"[email protected]", | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Carl Vitzthum" | ||
] | ||
}, | ||
"David Michaels": { | ||
"emails": [ | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"David Michaels", | ||
"dmichaels-harvard" | ||
] | ||
}, | ||
"Douglas Rioux": { | ||
"emails": [ | ||
"[email protected]", | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Douglas Rioux", | ||
"drio18" | ||
] | ||
}, | ||
"Eric Berg": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Eric Berg" | ||
] | ||
}, | ||
"Jeremy Johnson": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Jeremy Johnson", | ||
"j1z0" | ||
] | ||
}, | ||
"Kent M Pitman": { | ||
"emails": [ | ||
"[email protected]", | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Kent M Pitman", | ||
"Kent Pitman" | ||
] | ||
}, | ||
"Koray K\u0131rl\u0131": { | ||
"emails": [ | ||
"[email protected]", | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Koray K\u0131rl\u0131" | ||
] | ||
}, | ||
"Luisa Mercado": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Lmercadom", | ||
"Luisa Mercado" | ||
] | ||
}, | ||
"Sarah Reiff": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Sarah", | ||
"Sarah Reiff" | ||
] | ||
}, | ||
"Soo Lee": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Soo Lee", | ||
"SooLee" | ||
] | ||
}, | ||
"Will Ronchetti": { | ||
"emails": [ | ||
"[email protected]" | ||
], | ||
"names": [ | ||
"Will Ronchetti", | ||
"William Ronchetti" | ||
] | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import argparse | ||
|
||
from dcicutils.command_utils import script_catch_errors, ScriptFailure | ||
from .contribution_utils import Contributions, PROJECT_HOME | ||
|
||
|
||
EPILOG = __doc__ | ||
|
||
|
||
def show_contributors(repo, exclude_fork=None, verbose=False, save_contributors=False, test=False): | ||
contributions = Contributions(repo=repo, exclude_fork=exclude_fork, verbose=verbose) | ||
if save_contributors: | ||
contributions.save_contributor_data() | ||
contributions.show_repo_contributors(error_class=ScriptFailure if test else None) | ||
|
||
|
||
def show_contributors_main(*, simulated_args=None): | ||
parser = argparse.ArgumentParser( # noqa - PyCharm wrongly thinks the formatter_class is specified wrong here. | ||
description=(f"Show authors of a specified repository, which will be presumed" | ||
f" to have been cloned as a subdirectory of $PROJECT_HOME ({PROJECT_HOME})"), | ||
epilog=EPILOG, | ||
formatter_class=argparse.RawDescriptionHelpFormatter, | ||
) | ||
parser.add_argument('repo', default=None, | ||
help="name of repository to show contributors for") | ||
parser.add_argument('--exclude', '-x', default=None, | ||
help="name of repository that repo was forked from, whose contributors to exclude") | ||
parser.add_argument('--save-contributors', '-s', action="store_true", default=False, | ||
help="whether to store contributor data to CONTRIBUTORS.json") | ||
parser.add_argument('--test', '-t', action="store_true", default=False, | ||
help="whether to treat this as a test, erring if a cache update is needed") | ||
parser.add_argument('--verbose', '-v', action="store_true", default=False, | ||
help="whether to do verbose output while working") | ||
args = parser.parse_args(args=simulated_args) | ||
|
||
with script_catch_errors(): | ||
|
||
show_contributors(repo=args.repo, exclude_fork=args.exclude, verbose=args.verbose, | ||
save_contributors=args.save_contributors, test=args.test) |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Looks like something that may need correcting in encoding?
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.
No, I think it's safer this way. It will output correctly. It can be read by the default python reader and it will display as real unicode if you print it out in a regular file or on the terminal.