[oe-commits] [bitbake] 01/09: bitbake-selftest: utilize unittest.main better

git at git.openembedded.org git at git.openembedded.org
Fri Aug 19 15:51:53 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 8c513580b9406b031674f799117eae7410f8e01c
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Thu Aug 18 19:55:51 2016 +0300

    bitbake-selftest: utilize unittest.main better
    
    This simplifies the script, and, gives new features. It is now possible
    to run single test functions, for example. This is nice when writing new
    test cases.
    
    Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 bin/bitbake-selftest | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/bin/bitbake-selftest b/bin/bitbake-selftest
index 1e6f35e..1e615cc 100755
--- a/bin/bitbake-selftest
+++ b/bin/bitbake-selftest
@@ -25,31 +25,17 @@ try:
 except RuntimeError as exc:
     sys.exit(str(exc))
 
-def usage():
-    print('usage: [BB_SKIP_NETTESTS=yes] %s [-v] [testname1 [testname2]...]' % os.path.basename(sys.argv[0]))
-
-verbosity = 1
-
-tests = sys.argv[1:]
-if '-v' in sys.argv:
-    tests.remove('-v')
-    verbosity = 2
-
-if tests:
-    if '--help' in sys.argv[1:]:
-        usage()
-        sys.exit(0)
-else:
-    tests = ["bb.tests.codeparser",
-             "bb.tests.cow",
-             "bb.tests.data",
-             "bb.tests.fetch",
-             "bb.tests.parse",
-             "bb.tests.utils"]
+tests = ["bb.tests.codeparser",
+         "bb.tests.cow",
+         "bb.tests.data",
+         "bb.tests.fetch",
+         "bb.tests.parse",
+         "bb.tests.utils"]
 
 for t in tests:
     t = '.'.join(t.split('.')[:3])
     __import__(t)
 
-unittest.main(argv=["bitbake-selftest"] + tests, verbosity=verbosity)
 
+if __name__ == '__main__':
+        unittest.main(defaultTest=tests)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list