support/run-tests: check for empty sequences in a pythonic way
authorYegor Yefremov <yegorslists@googlemail.com>
Thu, 13 Feb 2020 10:09:06 +0000 (11:09 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 16 Feb 2020 14:38:03 +0000 (15:38 +0100)
According to PEP8 empty sequences should be checked as booleans.

Fixes the following PEP8 warning:
Do not use `len(SEQUENCE)` to determine if a sequence is empty

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
support/testing/run-tests

index 74741aee1b90629aedb1aabcabc022e57f45e90d..f295c053ff51bb07b2c59a2d77cc985f3eb4ae32 100755 (executable)
@@ -70,7 +70,7 @@ def main():
 
     BRConfigTest.outputdir = os.path.abspath(args.output)
 
-    if args.all is False and len(args.testname) == 0:
+    if args.all is False and not args.testname:
         print("No test selected")
         print("")
         parser.print_help()
@@ -112,7 +112,7 @@ def main():
                   "-s", test_dir,
                   "-c", os.path.join(test_dir, "conf/unittest.cfg")]
 
-    if len(args.testname) != 0:
+    if args.testname:
         nose2_args += args.testname
 
     nose2.discover(argv=nose2_args)