diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-09 16:31:22 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-16 23:32:39 +0100 |
commit | 1fc840ffc0267ecf3a15c4a59ab44869ef1d6339 (patch) | |
tree | b2932a0d0d7146bde799db47497236063050fc84 /scripts/oe-selftest | |
parent | 22c8ed6484e0ee9328e3844c9e794f3d89ebb9f7 (diff) | |
download | poky-1fc840ffc0267ecf3a15c4a59ab44869ef1d6339.tar.gz |
meta: python3 megapatch
This needs splutting into smaller units, WIP atm.
(From OE-Core rev: 21529228a7dca96a6a1b44ed9380c523efdeeb3e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-selftest')
-rwxr-xr-x | scripts/oe-selftest | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest index f621fd7e4e..6422505d8f 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python3 |
2 | 2 | ||
3 | # Copyright (c) 2013 Intel Corporation | 3 | # Copyright (c) 2013 Intel Corporation |
4 | # | 4 | # |
@@ -34,6 +34,8 @@ import subprocess | |||
34 | import time as t | 34 | import time as t |
35 | import re | 35 | import re |
36 | import fnmatch | 36 | import fnmatch |
37 | import collections | ||
38 | import imp | ||
37 | 39 | ||
38 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib') | 40 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib') |
39 | import scriptpath | 41 | import scriptpath |
@@ -211,7 +213,7 @@ def get_tests_from_module(tmod): | |||
211 | try: | 213 | try: |
212 | import importlib | 214 | import importlib |
213 | modlib = importlib.import_module(tmod) | 215 | modlib = importlib.import_module(tmod) |
214 | for mod in vars(modlib).values(): | 216 | for mod in list(vars(modlib).values()): |
215 | if isinstance(mod, type(oeSelfTest)) and issubclass(mod, oeSelfTest) and mod is not oeSelfTest: | 217 | if isinstance(mod, type(oeSelfTest)) and issubclass(mod, oeSelfTest) and mod is not oeSelfTest: |
216 | for test in dir(mod): | 218 | for test in dir(mod): |
217 | if test.startswith('test_') and hasattr(vars(mod)[test], '__call__'): | 219 | if test.startswith('test_') and hasattr(vars(mod)[test], '__call__'): |
@@ -415,7 +417,7 @@ def coverage_report(): | |||
415 | # Coverage under version 4 uses coverage.coverage | 417 | # Coverage under version 4 uses coverage.coverage |
416 | from coverage import coverage as Coverage | 418 | from coverage import coverage as Coverage |
417 | 419 | ||
418 | import cStringIO as StringIO | 420 | import io as StringIO |
419 | from coverage.misc import CoverageException | 421 | from coverage.misc import CoverageException |
420 | 422 | ||
421 | cov_output = StringIO.StringIO() | 423 | cov_output = StringIO.StringIO() |
@@ -492,7 +494,7 @@ def main(): | |||
492 | if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: | 494 | if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: |
493 | print(" --", v) | 495 | print(" --", v) |
494 | for method in dir(t): | 496 | for method in dir(t): |
495 | if method.startswith("test_") and callable(vars(t)[method]): | 497 | if method.startswith("test_") and isinstance(vars(t)[method], collections.Callable): |
496 | print(" -- --", method) | 498 | print(" -- --", method) |
497 | 499 | ||
498 | except (AttributeError, ImportError) as e: | 500 | except (AttributeError, ImportError) as e: |