]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/utils/decorators: Fix up frame selection
authorNathan Rossi <nathan.rossi@xilinx.com>
Thu, 16 Apr 2015 08:29:24 +0000 (18:29 +1000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 21 Apr 2015 06:19:05 +0000 (07:19 +0100)
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@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/decorators.py

index 1e5a890fdd0b6ad5355287541060b8e1abbc75c1..61a1a739eae0c6731114b18f1e5a4de0b5bd6f7c 100644 (file)
@@ -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