diff options
author | Nathan Rossi <nathan.rossi@xilinx.com> | 2015-04-16 18:29:24 +1000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-21 07:20:25 +0100 |
commit | 71db5767a875ca2834eb2434ff67b4af56d77920 (patch) | |
tree | 20984c0df3a87a6c75a50698116aae612cccb2ce /meta/lib | |
parent | 72830226190b828854e3d27720711f9c147bfe28 (diff) | |
download | poky-71db5767a875ca2834eb2434ff67b4af56d77920.tar.gz |
oeqa/utils/decorators: Fix up frame selection
Use threading to get the current threads ident to select the current
executing frame to ensure that the scanned stack is the expected stack.
This allows for the decorators to be used within a process that has
multiple threads executing.
(From OE-Core rev: a44d27b92baba4ab51f432ec01cdc473436ce406)
Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/utils/decorators.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py index 1e5a890fdd..61a1a739ea 100644 --- a/meta/lib/oeqa/utils/decorators.py +++ b/meta/lib/oeqa/utils/decorators.py | |||
@@ -10,12 +10,14 @@ import os | |||
10 | import logging | 10 | import logging |
11 | import sys | 11 | import sys |
12 | import unittest | 12 | import unittest |
13 | import threading | ||
13 | 14 | ||
14 | #get the "result" object from one of the upper frames provided that one of these upper frames is a unittest.case frame | 15 | #get the "result" object from one of the upper frames provided that one of these upper frames is a unittest.case frame |
15 | class getResults(object): | 16 | class getResults(object): |
16 | def __init__(self): | 17 | def __init__(self): |
17 | #dynamically determine the unittest.case frame and use it to get the name of the test method | 18 | #dynamically determine the unittest.case frame and use it to get the name of the test method |
18 | upperf = sys._current_frames().values()[0] | 19 | ident = threading.current_thread().ident |
20 | upperf = sys._current_frames()[ident] | ||
19 | while (upperf.f_globals['__name__'] != 'unittest.case'): | 21 | while (upperf.f_globals['__name__'] != 'unittest.case'): |
20 | upperf = upperf.f_back | 22 | upperf = upperf.f_back |
21 | 23 | ||