[oe-commits] [openembedded-core] 02/07: meta: print fixes

git at git.openembedded.org git at git.openembedded.org
Wed May 11 09:56:01 UTC 2016


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

commit 6053c401b6d1c7c5bc8ff014ead6c129f43bb792
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed May 11 10:28:38 2016 +0100

    meta: print fixes
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/selftest/base.py |  2 +-
 scripts/oe-selftest            | 48 +++++++++++++++++++++---------------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/meta/lib/oeqa/selftest/base.py b/meta/lib/oeqa/selftest/base.py
index e10455e..b5a52fe 100644
--- a/meta/lib/oeqa/selftest/base.py
+++ b/meta/lib/oeqa/selftest/base.py
@@ -67,7 +67,7 @@ class oeSelfTest(unittest.TestCase):
                 machine = custommachine
             machine_conf = 'MACHINE ??= "%s"\n' % machine
             self.set_machine_config(machine_conf)
-            print 'MACHINE: %s' % machine
+            print('MACHINE: %s' % machine)
 
         # tests might need their own setup
         # but if they overwrite this one they have to call
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index 5e23ef0..f621fd7 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -220,12 +220,12 @@ def get_tests_from_module(tmod):
                         try:
                             tid = vars(mod)[test].test_case
                         except:
-                            print 'DEBUG: tc id missing for ' + str(test)
+                            print(('DEBUG: tc id missing for ' + str(test)))
                             tid = None
                         try:
                             ttag = vars(mod)[test].tag__feature
                         except:
-                            # print 'DEBUG: feature tag missing for ' + str(test)
+                            # print('DEBUG: feature tag missing for ' + str(test))
                             ttag = None
 
                         # NOTE: for some reason lstrip() doesn't work for mod.__module__
@@ -320,17 +320,17 @@ def list_testsuite_by(criteria, keyword):
 
     ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ])
 
-    print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module')
-    print '_' * 150
+    print(('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module')))
+    print(('_' * 150))
     for t in ts:
         if isinstance(t[1], (tuple, list)):
-            print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t[0], ', '.join(t[1]), t[2], t[3], t[4])
+            print(('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t[0], ', '.join(t[1]), t[2], t[3], t[4])))
         else:
-            print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % t
-    print '_' * 150
-    print 'Filtering by:\t %s' % criteria
-    print 'Looking for:\t %s' % ', '.join(str(x) for x in keyword)
-    print 'Total found:\t %s' % len(ts)
+            print(('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % t))
+    print(('_' * 150))
+    print('Filtering by:\t %s' % criteria)
+    print('Looking for:\t %s' % ', '.join(str(x) for x in keyword))
+    print('Total found:\t %s' % len(ts))
 
 
 def list_tests():
@@ -338,15 +338,15 @@ def list_tests():
 
     ts = get_all_tests()
 
-    print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module')
-    print '_' * 150
+    print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module'))
+    print('_' * 150)
     for t in ts:
         if isinstance(t.tctag, (tuple, list)):
-            print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, ', '.join(t.tctag), t.tcname, t.tcclass, t.tcmodule)
+            print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, ', '.join(t.tctag), t.tcname, t.tcclass, t.tcmodule))
         else:
-            print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, t.tctag, t.tcname, t.tcclass, t.tcmodule)
-    print '_' * 150
-    print 'Total found:\t %s' % len(ts)
+            print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, t.tctag, t.tcname, t.tcclass, t.tcmodule))
+    print('_' * 150)
+    print('Total found:\t %s' % len(ts))
 
 
 def list_tags():
@@ -362,7 +362,7 @@ def list_tags():
         else:
             tags.add(tc.tctag)
 
-    print 'Tags:\t%s' % ', '.join(str(x) for x in tags)
+    print('Tags:\t%s' % ', '.join(str(x) for x in tags))
 
 def coverage_setup(coverage_source, coverage_include, coverage_omit):
     """ Set up the coverage measurement for the testcases to be run """
@@ -443,12 +443,12 @@ def main():
     bbpath = get_bb_var('BBPATH').split(':')
     layer_libdirs = [p for p in (os.path.join(l, 'lib') for l in bbpath) if os.path.exists(p)]
     sys.path.extend(layer_libdirs)
-    reload(oeqa.selftest)
+    imp.reload(oeqa.selftest)
 
     if args.run_tests_by and len(args.run_tests_by) >= 2:
         valid_options = ['name', 'class', 'module', 'id', 'tag']
         if args.run_tests_by[0] not in valid_options:
-            print '--run-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.run_tests_by[0]
+            print('--run-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.run_tests_by[0])
             return 1
         else:
             criteria = args.run_tests_by[0]
@@ -458,7 +458,7 @@ def main():
     if args.list_tests_by and len(args.list_tests_by) >= 2:
         valid_options = ['name', 'class', 'module', 'id', 'tag']
         if args.list_tests_by[0] not in valid_options:
-            print '--list-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.list_tests_by[0]
+            print('--list-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.list_tests_by[0])
             return 1
         else:
             criteria = args.list_tests_by[0]
@@ -482,7 +482,7 @@ def main():
             info = ''
             if module.startswith('_'):
                 info = ' (hidden)'
-            print module + info
+            print(module + info)
             if args.list_allclasses:
                 try:
                     import importlib
@@ -490,13 +490,13 @@ def main():
                     for v in vars(modlib):
                         t = vars(modlib)[v]
                         if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest:
-                            print " --", v
+                            print(" --", v)
                             for method in dir(t):
                                 if method.startswith("test_") and callable(vars(t)[method]):
-                                    print " --  --", method
+                                    print(" --  --", method)
 
                 except (AttributeError, ImportError) as e:
-                    print e
+                    print(e)
                     pass
 
     if args.run_tests or args.run_all_tests or args.run_tests_by:

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


More information about the Openembedded-commits mailing list