[oe-commits] [bitbake] 02/02: tests/utils.py: test origvalue in a callback matches what is expected

git at git.openembedded.org git at git.openembedded.org
Thu Apr 7 17:03:10 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 206f907585f30809fc25bd9b8980d838161bc049
Author: Randy Witt <randy.e.witt at linux.intel.com>
AuthorDate: Wed Apr 6 23:55:40 2016 -0700

    tests/utils.py: test origvalue in a callback matches what is expected
    
    There were any tests that checked to make verify the value of origvalue in
    the callback routines used by edit_metadata(). This patch adds one for a
    simple multiline variable.
    
    Signed-off-by: Randy Witt <randy.e.witt at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/tests/utils.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lib/bb/tests/utils.py b/lib/bb/tests/utils.py
index 6ded4df..2f4ccf3 100644
--- a/lib/bb/tests/utils.py
+++ b/lib/bb/tests/utils.py
@@ -23,6 +23,7 @@ import unittest
 import bb
 import os
 import tempfile
+import re
 
 class VerCmpString(unittest.TestCase):
 
@@ -377,6 +378,27 @@ do_functionname() {
         self.assertTrue(updated, 'List should be updated but isn\'t')
         self.assertEqual(newlines, newfile5.splitlines(True))
 
+    # Make sure the orig value matches what we expect it to be
+    def test_edit_metadata_origvalue(self):
+        origfile = """
+MULTILINE = "  stuff \\
+    morestuff"
+"""
+        expected_value = "stuff morestuff"
+        global value_in_callback
+        value_in_callback = ""
+
+        def handle_var(varname, origvalue, op, newlines):
+            global value_in_callback
+            value_in_callback = origvalue
+            return (origvalue, op, -1, False)
+
+        bb.utils.edit_metadata(origfile.splitlines(True),
+                               ['MULTILINE'],
+                               handle_var)
+
+        testvalue = re.sub('\s+', ' ', value_in_callback.strip())
+        self.assertEqual(expected_value, testvalue)
 
 class EditBbLayersConf(unittest.TestCase):
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list