diff options
author | Lucian Musat <georgex.l.musat@intel.com> | 2014-07-24 15:41:24 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-25 15:34:00 +0100 |
commit | 0c4dd0ad168e138ba96eaf27aa7e513aaf6704ee (patch) | |
tree | 04108e45fe1750a44b72ca1650f4cb8e1d466369 /meta/lib/oeqa/oetest.py | |
parent | 0565d8bc17b061a8a6087f1667e10a3e3608c88e (diff) | |
download | poky-0c4dd0ad168e138ba96eaf27aa7e513aaf6704ee.tar.gz |
oeqa: Refactor test skipping decorators to use the unittest result object
In order to make the test skipping decorators independent of the oeTest object we rely on the unittest result object to construct skip, fail and error lists used by these decorators.
Created a new object getResults that analyses upper frames and retrieves the unittest result object instance, then return a list of failed, skipped and error tests.
Also removed the oetest import from decorators.py because it was no longer required.
(From OE-Core rev: 4d2d201158236bd4c72546cf8db88681ff921b11)
Signed-off-by: Lucian Musat <georgex.l.musat@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/oetest.py')
-rw-r--r-- | meta/lib/oeqa/oetest.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py index 0db6cb80a9..ecb8e53705 100644 --- a/meta/lib/oeqa/oetest.py +++ b/meta/lib/oeqa/oetest.py | |||
@@ -11,7 +11,6 @@ import os, re, mmap | |||
11 | import unittest | 11 | import unittest |
12 | import inspect | 12 | import inspect |
13 | 13 | ||
14 | |||
15 | def loadTests(tc): | 14 | def loadTests(tc): |
16 | 15 | ||
17 | # set the context object passed from the test class | 16 | # set the context object passed from the test class |
@@ -36,24 +35,9 @@ def runTests(tc): | |||
36 | 35 | ||
37 | return result | 36 | return result |
38 | 37 | ||
39 | |||
40 | class oeTest(unittest.TestCase): | 38 | class oeTest(unittest.TestCase): |
41 | 39 | ||
42 | longMessage = True | 40 | longMessage = True |
43 | testFailures = [] | ||
44 | testSkipped = [] | ||
45 | testErrors = [] | ||
46 | |||
47 | def run(self, result=None): | ||
48 | super(oeTest, self).run(result) | ||
49 | |||
50 | # we add to our own lists the results, we use those for decorators | ||
51 | if len(result.failures) > len(oeTest.testFailures): | ||
52 | oeTest.testFailures.append(str(result.failures[-1][0]).split()[0]) | ||
53 | if len(result.skipped) > len(oeTest.testSkipped): | ||
54 | oeTest.testSkipped.append(str(result.skipped[-1][0]).split()[0]) | ||
55 | if len(result.errors) > len(oeTest.testErrors): | ||
56 | oeTest.testErrors.append(str(result.errors[-1][0]).split()[0]) | ||
57 | 41 | ||
58 | @classmethod | 42 | @classmethod |
59 | def hasPackage(self, pkg): | 43 | def hasPackage(self, pkg): |
@@ -71,7 +55,6 @@ class oeTest(unittest.TestCase): | |||
71 | else: | 55 | else: |
72 | return False | 56 | return False |
73 | 57 | ||
74 | |||
75 | class oeRuntimeTest(oeTest): | 58 | class oeRuntimeTest(oeTest): |
76 | 59 | ||
77 | def __init__(self, methodName='runTest'): | 60 | def __init__(self, methodName='runTest'): |