summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2017-06-29 15:02:14 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-21 08:44:25 +0100
commitbec45829e3c27b7e7df8769725a5b49ef6d1f679 (patch)
tree6906e973341887658e06e327035b04fe4a2ca7a5
parent1ae1df385311fb06838261c33f1bf4d1ea368c39 (diff)
downloadpoky-bec45829e3c27b7e7df8769725a5b49ef6d1f679.tar.gz
oeqa/core/loader: Generate function _make_failed_test dynamically
Python versions has different features from branches 3.4.x, 3.5.x and 3.6.x, i expected in wrong mode that was incremental for example changes in 3.4.4 be in 3.5.x but that's not true. The _make_failed_test internal method differs and is only available in certain versions >= 3.4.4 and in 3.5.x and 3.6.x branches but not realeses have been made including it. So to avoid futher problems inspect the _make_failed_test and generates function definition according what parameters are needed, the unique supossition is that exception argument is always passed. Related to, http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=d8380d098a290510b442a7abd2dd5a50cabf5844 (From OE-Core rev: b4740d2b325a80bcecc5e56dff9add9081fcd31b) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/core/loader.py25
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 @@
4import os 4import os
5import sys 5import sys
6import unittest 6import unittest
7import inspect
7 8
8from oeqa.core.utils.path import findFile 9from oeqa.core.utils.path import findFile
9from oeqa.core.utils.test import getSuiteModules, getCaseID 10from oeqa.core.utils.test import getSuiteModules, getCaseID
@@ -12,19 +13,17 @@ from oeqa.core.case import OETestCase
12from oeqa.core.decorator import decoratorClasses, OETestDecorator, \ 13from oeqa.core.decorator import decoratorClasses, OETestDecorator, \
13 OETestFilter, OETestDiscover 14 OETestFilter, OETestDiscover
14 15
15if 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
25else: 26exec("""def _make_failed_test(%s): raise exception""" % ', '.join(_failed_test_args))
26 def _make_failed_test(classname, exception, suiteClass):
27 raise exception
28unittest.loader._make_failed_test = _make_failed_test 27unittest.loader._make_failed_test = _make_failed_test
29 28
30def _find_duplicated_modules(suite, directory): 29def _find_duplicated_modules(suite, directory):