diff options
author | Ben Sima <ben@bsima.me> | 2024-12-01 21:46:29 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2024-12-21 10:08:01 -0500 |
commit | aafa73c47325185ed733da387c9649d934f6529c (patch) | |
tree | bc2e180afa7151b736a02a37701b731baf9ce795 /Biz/Dragons/main.py | |
parent | 2ed757bc8c60fad0f2bf9d07478e2a287b7e24aa (diff) |
Test Python code with bild --test
I had forgotten to add this feature, apparently, so bild --test just didn't do
the test part.
Diffstat (limited to 'Biz/Dragons/main.py')
-rw-r--r-- | Biz/Dragons/main.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/Biz/Dragons/main.py b/Biz/Dragons/main.py index f85d9e7..e9df03f 100644 --- a/Biz/Dragons/main.py +++ b/Biz/Dragons/main.py @@ -225,27 +225,32 @@ def guard_git(repo: Repo) -> None: sys.exit(f"error: not a git repository: {repo}") -if __name__ == "__main__": - ARGS = get_args() - if ARGS.test: +def main() -> None: + """Entrypoint.""" + args = get_args() + if args.test: sys.stdout.write("ok") sys.exit() - logging.basicConfig(stream=sys.stderr, level=ARGS.verbosity.upper()) + logging.basicConfig(stream=sys.stderr, level=args.verbosity.upper()) logging.debug("starting") - os.chdir(pathlib.Path(ARGS.repo).resolve()) + os.chdir(pathlib.Path(args.repo).resolve()) - guard_git(ARGS.repo) + guard_git(args.repo) # if no active users provided, load from .mailmap - if ARGS.active_users == [] and pathlib.Path(".mailmap").exists(): - ARGS.active_users = mailmap_users() + if args.active_users == [] and pathlib.Path(".mailmap").exists(): + args.active_users = mailmap_users() # collect data - REPO = Repo(ARGS.ignored, ARGS.active_users) + repo = Repo(args.ignored, args.active_users) # print data - REPO.print_score() - REPO.print_blackholes(full=ARGS.blackholes) - REPO.print_liabilities(full=ARGS.liabilities) - REPO.print_stale(full=ARGS.stale) + repo.print_score() + repo.print_blackholes(full=args.blackholes) + repo.print_liabilities(full=args.liabilities) + repo.print_stale(full=args.stale) + + +if __name__ == "__main__": + main() |