diff options
| -rw-r--r-- | meta/lib/oeqa/core/loader.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py index 80e3d2800c..e4c218b57f 100644 --- a/meta/lib/oeqa/core/loader.py +++ b/meta/lib/oeqa/core/loader.py | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | import os | 4 | import os |
| 5 | import sys | 5 | import sys |
| 6 | import unittest | 6 | import unittest |
| 7 | import inspect | ||
| 7 | 8 | ||
| 8 | from oeqa.core.utils.path import findFile | 9 | from oeqa.core.utils.path import findFile |
| 9 | from oeqa.core.utils.test import getSuiteModules, getCaseID | 10 | from oeqa.core.utils.test import getSuiteModules, getCaseID |
| @@ -12,19 +13,17 @@ from oeqa.core.case import OETestCase | |||
| 12 | from oeqa.core.decorator import decoratorClasses, OETestDecorator, \ | 13 | from oeqa.core.decorator import decoratorClasses, OETestDecorator, \ |
| 13 | OETestFilter, OETestDiscover | 14 | OETestFilter, OETestDiscover |
| 14 | 15 | ||
| 15 | if sys.version_info >= (3,4,4): | 16 | # When loading tests, the unittest framework stores any exceptions and |
| 16 | def _make_failed_test(classname, methodname, exception, suiteClass): | 17 | # displays them only when the run method is called. |
| 17 | """ | 18 | # |
| 18 | When loading tests, the unittest framework stores any exceptions and | 19 | # For our purposes, it is better to raise the exceptions in the loading |
| 19 | displays them only when the 'run' method is called. | 20 | # step rather than waiting to run the test suite. |
| 20 | 21 | # | |
| 21 | For our purposes, it is better to raise the exceptions in the loading | 22 | # Generate the function definition because this differ across python versions |
| 22 | step rather than waiting to run the test suite. | 23 | # Python >= 3.4.4 uses tree parameters instead four but for example Python 3.5.3 |
| 23 | """ | 24 | # ueses four parameters so isn't incremental. |
| 24 | raise exception | 25 | _failed_test_args = inspect.getargspec(unittest.loader._make_failed_test).args |
| 25 | else: | 26 | exec("""def _make_failed_test(%s): raise exception""" % ', '.join(_failed_test_args)) |
| 26 | def _make_failed_test(classname, exception, suiteClass): | ||
| 27 | raise exception | ||
| 28 | unittest.loader._make_failed_test = _make_failed_test | 27 | unittest.loader._make_failed_test = _make_failed_test |
| 29 | 28 | ||
| 30 | def _find_duplicated_modules(suite, directory): | 29 | def _find_duplicated_modules(suite, directory): |
