[oe-commits] Nathan Rossi : oeqa/utils/decorators: Fix up frame selection

git at git.openembedded.org git at git.openembedded.org
Tue Apr 21 06:20:57 UTC 2015


Module: openembedded-core.git
Branch: master
Commit: a44d27b92baba4ab51f432ec01cdc473436ce406
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=a44d27b92baba4ab51f432ec01cdc473436ce406

Author: Nathan Rossi <nathan.rossi at xilinx.com>
Date:   Thu Apr 16 18:29:24 2015 +1000

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.

Signed-off-by: Nathan Rossi <nathan.rossi at xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oeqa/utils/decorators.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py
index 1e5a890..61a1a73 100644
--- a/meta/lib/oeqa/utils/decorators.py
+++ b/meta/lib/oeqa/utils/decorators.py
@@ -10,12 +10,14 @@ import os
 import logging
 import sys
 import unittest
+import threading
 
 #get the "result" object from one of the upper frames provided that one of these upper frames is a unittest.case frame
 class getResults(object):
     def __init__(self):
         #dynamically determine the unittest.case frame and use it to get the name of the test method
-        upperf = sys._current_frames().values()[0]
+        ident = threading.current_thread().ident
+        upperf = sys._current_frames()[ident]
         while (upperf.f_globals['__name__'] != 'unittest.case'):
             upperf = upperf.f_back
 



More information about the Openembedded-commits mailing list