[Buildroot] [PATCH 2/2] support/run-tests: check for empty sequences in a pythonic way

yegorslists at googlemail.com yegorslists at googlemail.com
Thu Feb 13 10:09:06 UTC 2020


From: Yegor Yefremov <yegorslists at googlemail.com>

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 at googlemail.com>
---
 support/testing/run-tests | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/support/testing/run-tests b/support/testing/run-tests
index 77a13dc78c..022209b414 100755
--- a/support/testing/run-tests
+++ b/support/testing/run-tests
@@ -71,7 +71,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()
@@ -113,7 +113,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)
-- 
2.17.0



More information about the buildroot mailing list