From 47a00df1f0700e471adb96b1ec80b05f56c8032d Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 27 May 2022 11:45:15 +0200 Subject: [PATCH] test: fix a couple of pylint warnings --- test/test-shutdown.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/test-shutdown.py b/test/test-shutdown.py index 1a91753b87a..77ac3a7d9fb 100755 --- a/test/test-shutdown.py +++ b/test/test-shutdown.py @@ -4,9 +4,10 @@ import argparse import logging -import pexpect import sys +import pexpect + def run(args): @@ -21,7 +22,7 @@ def run(args): if args.verbose: console.logfile = sys.stdout - logger.debug("child pid %d" % console.pid) + logger.debug("child pid %d", console.pid) try: logger.info("waiting for login prompt") @@ -88,13 +89,12 @@ def run(args): ret = 0 except Exception as e: logger.error(e) - logger.info("killing child pid %d" % console.pid) + logger.info("killing child pid %d", console.pid) console.terminate() return ret - -if __name__ == '__main__': +def main(): parser = argparse.ArgumentParser(description='test logind shutdown feature') parser.add_argument("-v", "--verbose", action="store_true", help="verbose") parser.add_argument("command", help="command to run") @@ -109,6 +109,9 @@ if __name__ == '__main__': logging.basicConfig(level=level) - sys.exit(run(args)) + return run(args) + +if __name__ == '__main__': + sys.exit(main()) # vim: sw=4 et