Skip to contentSkip to conversation

tests/data: Add a key deletion test

PATCH New Richard Purdie 1 participant 1 message Dec 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/data: Add a key deletion test

If you copy the datastore, then delete a key, it should not exist in d.keys(). This adds a test to cover the recently found data store bug.

bitbake/lib/bb/tests/data.py +6 -0
index 9b09ff4..81e4091 100644
@@ -121,6 +121,12 @@ class DataExpansions(unittest.TestCase):
         keys = self.d.keys()
         self.assertEqual(keys, ['value_of_foo', 'foo', 'bar'])
 
+    def test_keys_deletion(self):
+        newd = bb.data.createCopy(self.d)
+        newd.delVar("bar")
+        keys = newd.keys()
+        self.assertEqual(keys, ['value_of_foo', 'foo'])
+
 class TestNestedExpansions(unittest.TestCase):
     def setUp(self):
         self.d = bb.data.init()