diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-11 10:28:38 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-16 23:32:39 +0100 |
commit | 22c8ed6484e0ee9328e3844c9e794f3d89ebb9f7 (patch) | |
tree | b7dea0b7b46d5eeb24bd79e5d78c19b0b3eabd26 | |
parent | bda68e63e2b002069200b8c810225bcba109dce3 (diff) | |
download | poky-22c8ed6484e0ee9328e3844c9e794f3d89ebb9f7.tar.gz |
meta: print fixes
(From OE-Core rev: a61ef5d2ae479a2db6b020e1be55eeaa331ab756)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/selftest/base.py | 2 | ||||
-rwxr-xr-x | 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 e10455edc1..b5a52fe57a 100644 --- a/meta/lib/oeqa/selftest/base.py +++ b/meta/lib/oeqa/selftest/base.py | |||
@@ -67,7 +67,7 @@ class oeSelfTest(unittest.TestCase): | |||
67 | machine = custommachine | 67 | machine = custommachine |
68 | machine_conf = 'MACHINE ??= "%s"\n' % machine | 68 | machine_conf = 'MACHINE ??= "%s"\n' % machine |
69 | self.set_machine_config(machine_conf) | 69 | self.set_machine_config(machine_conf) |
70 | print 'MACHINE: %s' % machine | 70 | print('MACHINE: %s' % machine) |
71 | 71 | ||
72 | # tests might need their own setup | 72 | # tests might need their own setup |
73 | # but if they overwrite this one they have to call | 73 | # but if they overwrite this one they have to call |
diff --git a/scripts/oe-selftest b/scripts/oe-selftest index 5e23ef0038..f621fd7e4e 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest | |||
@@ -220,12 +220,12 @@ def get_tests_from_module(tmod): | |||
220 | try: | 220 | try: |
221 | tid = vars(mod)[test].test_case | 221 | tid = vars(mod)[test].test_case |
222 | except: | 222 | except: |
223 | print 'DEBUG: tc id missing for ' + str(test) | 223 | print(('DEBUG: tc id missing for ' + str(test))) |
224 | tid = None | 224 | tid = None |
225 | try: | 225 | try: |
226 | ttag = vars(mod)[test].tag__feature | 226 | ttag = vars(mod)[test].tag__feature |
227 | except: | 227 | except: |
228 | # print 'DEBUG: feature tag missing for ' + str(test) | 228 | # print('DEBUG: feature tag missing for ' + str(test)) |
229 | ttag = None | 229 | ttag = None |
230 | 230 | ||
231 | # NOTE: for some reason lstrip() doesn't work for mod.__module__ | 231 | # NOTE: for some reason lstrip() doesn't work for mod.__module__ |
@@ -320,17 +320,17 @@ def list_testsuite_by(criteria, keyword): | |||
320 | 320 | ||
321 | ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ]) | 321 | ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ]) |
322 | 322 | ||
323 | print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module') | 323 | print(('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module'))) |
324 | print '_' * 150 | 324 | print(('_' * 150)) |
325 | for t in ts: | 325 | for t in ts: |
326 | if isinstance(t[1], (tuple, list)): | 326 | if isinstance(t[1], (tuple, list)): |
327 | print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t[0], ', '.join(t[1]), t[2], t[3], t[4]) | 327 | print(('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t[0], ', '.join(t[1]), t[2], t[3], t[4]))) |
328 | else: | 328 | else: |
329 | print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % t | 329 | print(('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % t)) |
330 | print '_' * 150 | 330 | print(('_' * 150)) |
331 | print 'Filtering by:\t %s' % criteria | 331 | print('Filtering by:\t %s' % criteria) |
332 | print 'Looking for:\t %s' % ', '.join(str(x) for x in keyword) | 332 | print('Looking for:\t %s' % ', '.join(str(x) for x in keyword)) |
333 | print 'Total found:\t %s' % len(ts) | 333 | print('Total found:\t %s' % len(ts)) |
334 | 334 | ||
335 | 335 | ||
336 | def list_tests(): | 336 | def list_tests(): |
@@ -338,15 +338,15 @@ def list_tests(): | |||
338 | 338 | ||
339 | ts = get_all_tests() | 339 | ts = get_all_tests() |
340 | 340 | ||
341 | print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module') | 341 | print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module')) |
342 | print '_' * 150 | 342 | print('_' * 150) |
343 | for t in ts: | 343 | for t in ts: |
344 | if isinstance(t.tctag, (tuple, list)): | 344 | if isinstance(t.tctag, (tuple, list)): |
345 | print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, ', '.join(t.tctag), t.tcname, t.tcclass, t.tcmodule) | 345 | print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, ', '.join(t.tctag), t.tcname, t.tcclass, t.tcmodule)) |
346 | else: | 346 | else: |
347 | print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, t.tctag, t.tcname, t.tcclass, t.tcmodule) | 347 | print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t.tcid, t.tctag, t.tcname, t.tcclass, t.tcmodule)) |
348 | print '_' * 150 | 348 | print('_' * 150) |
349 | print 'Total found:\t %s' % len(ts) | 349 | print('Total found:\t %s' % len(ts)) |
350 | 350 | ||
351 | 351 | ||
352 | def list_tags(): | 352 | def list_tags(): |
@@ -362,7 +362,7 @@ def list_tags(): | |||
362 | else: | 362 | else: |
363 | tags.add(tc.tctag) | 363 | tags.add(tc.tctag) |
364 | 364 | ||
365 | print 'Tags:\t%s' % ', '.join(str(x) for x in tags) | 365 | print('Tags:\t%s' % ', '.join(str(x) for x in tags)) |
366 | 366 | ||
367 | def coverage_setup(coverage_source, coverage_include, coverage_omit): | 367 | def coverage_setup(coverage_source, coverage_include, coverage_omit): |
368 | """ Set up the coverage measurement for the testcases to be run """ | 368 | """ Set up the coverage measurement for the testcases to be run """ |
@@ -443,12 +443,12 @@ def main(): | |||
443 | bbpath = get_bb_var('BBPATH').split(':') | 443 | bbpath = get_bb_var('BBPATH').split(':') |
444 | layer_libdirs = [p for p in (os.path.join(l, 'lib') for l in bbpath) if os.path.exists(p)] | 444 | layer_libdirs = [p for p in (os.path.join(l, 'lib') for l in bbpath) if os.path.exists(p)] |
445 | sys.path.extend(layer_libdirs) | 445 | sys.path.extend(layer_libdirs) |
446 | reload(oeqa.selftest) | 446 | imp.reload(oeqa.selftest) |
447 | 447 | ||
448 | if args.run_tests_by and len(args.run_tests_by) >= 2: | 448 | if args.run_tests_by and len(args.run_tests_by) >= 2: |
449 | valid_options = ['name', 'class', 'module', 'id', 'tag'] | 449 | valid_options = ['name', 'class', 'module', 'id', 'tag'] |
450 | if args.run_tests_by[0] not in valid_options: | 450 | if args.run_tests_by[0] not in valid_options: |
451 | print '--run-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.run_tests_by[0] | 451 | print('--run-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.run_tests_by[0]) |
452 | return 1 | 452 | return 1 |
453 | else: | 453 | else: |
454 | criteria = args.run_tests_by[0] | 454 | criteria = args.run_tests_by[0] |
@@ -458,7 +458,7 @@ def main(): | |||
458 | if args.list_tests_by and len(args.list_tests_by) >= 2: | 458 | if args.list_tests_by and len(args.list_tests_by) >= 2: |
459 | valid_options = ['name', 'class', 'module', 'id', 'tag'] | 459 | valid_options = ['name', 'class', 'module', 'id', 'tag'] |
460 | if args.list_tests_by[0] not in valid_options: | 460 | if args.list_tests_by[0] not in valid_options: |
461 | print '--list-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.list_tests_by[0] | 461 | print('--list-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.list_tests_by[0]) |
462 | return 1 | 462 | return 1 |
463 | else: | 463 | else: |
464 | criteria = args.list_tests_by[0] | 464 | criteria = args.list_tests_by[0] |
@@ -482,7 +482,7 @@ def main(): | |||
482 | info = '' | 482 | info = '' |
483 | if module.startswith('_'): | 483 | if module.startswith('_'): |
484 | info = ' (hidden)' | 484 | info = ' (hidden)' |
485 | print module + info | 485 | print(module + info) |
486 | if args.list_allclasses: | 486 | if args.list_allclasses: |
487 | try: | 487 | try: |
488 | import importlib | 488 | import importlib |
@@ -490,13 +490,13 @@ def main(): | |||
490 | for v in vars(modlib): | 490 | for v in vars(modlib): |
491 | t = vars(modlib)[v] | 491 | t = vars(modlib)[v] |
492 | if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: | 492 | if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: |
493 | print " --", v | 493 | print(" --", v) |
494 | for method in dir(t): | 494 | for method in dir(t): |
495 | if method.startswith("test_") and callable(vars(t)[method]): | 495 | if method.startswith("test_") and callable(vars(t)[method]): |
496 | print " -- --", method | 496 | print(" -- --", method) |
497 | 497 | ||
498 | except (AttributeError, ImportError) as e: | 498 | except (AttributeError, ImportError) as e: |
499 | print e | 499 | print(e) |
500 | pass | 500 | pass |
501 | 501 | ||
502 | if args.run_tests or args.run_all_tests or args.run_tests_by: | 502 | if args.run_tests or args.run_all_tests or args.run_tests_by: |