kvm-test: don't execute code if module is imported

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-04-27 19:55:55 +02:00
parent 9ad7ff2747
commit 83dacb8c7c
1 changed files with 21 additions and 15 deletions

View File

@ -456,6 +456,8 @@ def help():
sys.exit(1) sys.exit(1)
def main() -> None:
""" Entry point. """
try: try:
ctx = parse_args() ctx = parse_args()
except TypeError: except TypeError:
@ -474,3 +476,7 @@ if ctx.args.boot:
boot(ctx) boot(ctx)
if True not in (ctx.args.build, ctx.args.install, ctx.args.boot): if True not in (ctx.args.build, ctx.args.install, ctx.args.boot):
parser.print_help() parser.print_help()
if __name__ == "__main__":
main()