summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tests/data.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py
index 7994a88a78..b4e90e0327 100644
--- a/bitbake/lib/bb/tests/data.py
+++ b/bitbake/lib/bb/tests/data.py
@@ -24,6 +24,30 @@ import unittest
24import bb 24import bb
25import bb.data 25import bb.data
26import bb.parse 26import bb.parse
27import logging
28
29class LogRecord():
30 def __enter__(self):
31 logs = []
32 class LogHandler(logging.Handler):
33 def emit(self, record):
34 logs.append(record)
35 logger = logging.getLogger("BitBake")
36 handler = LogHandler()
37 self.handler = handler
38 logger.addHandler(handler)
39 return logs
40 def __exit__(self, type, value, traceback):
41 logger = logging.getLogger("BitBake")
42 logger.removeHandler(self.handler)
43 return
44
45def logContains(item, logs):
46 for l in logs:
47 m = l.getMessage()
48 if item in m:
49 return True
50 return False
27 51
28class DataExpansions(unittest.TestCase): 52class DataExpansions(unittest.TestCase):
29 def setUp(self): 53 def setUp(self):
@@ -301,7 +325,6 @@ class TestOverrides(unittest.TestCase):
301 bb.data.update_data(self.d) 325 bb.data.update_data(self.d)
302 self.assertEqual(self.d.getVar("TEST", True), "testvalue3") 326 self.assertEqual(self.d.getVar("TEST", True), "testvalue3")
303 327
304
305class TestFlags(unittest.TestCase): 328class TestFlags(unittest.TestCase):
306 def setUp(self): 329 def setUp(self):
307 self.d = bb.data.init() 330 self.d = bb.data.init()