diff options
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index a17245f90a..ba30d12806 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -446,6 +446,29 @@ class Contains(unittest.TestCase): | |||
446 | self.assertFalse(bb.utils.contains_any("SOMEFLAG", "x y z", True, False, self.d)) | 446 | self.assertFalse(bb.utils.contains_any("SOMEFLAG", "x y z", True, False, self.d)) |
447 | 447 | ||
448 | 448 | ||
449 | class Serialize(unittest.TestCase): | ||
450 | |||
451 | def test_serialize(self): | ||
452 | import tempfile | ||
453 | import pickle | ||
454 | d = bb.data.init() | ||
455 | d.enableTracking() | ||
456 | d.setVar('HELLO', 'world') | ||
457 | d.setVarFlag('HELLO', 'other', 'planet') | ||
458 | with tempfile.NamedTemporaryFile(delete=False) as tmpfile: | ||
459 | tmpfilename = tmpfile.name | ||
460 | pickle.dump(d, tmpfile) | ||
461 | |||
462 | with open(tmpfilename, 'rb') as f: | ||
463 | newd = pickle.load(f) | ||
464 | |||
465 | os.remove(tmpfilename) | ||
466 | |||
467 | self.assertEqual(d, newd) | ||
468 | self.assertEqual(newd.getVar('HELLO', True), 'world') | ||
469 | self.assertEqual(newd.getVarFlag('HELLO', 'other'), 'planet') | ||
470 | |||
471 | |||
449 | class Remote(unittest.TestCase): | 472 | class Remote(unittest.TestCase): |
450 | def test_remote(self): | 473 | def test_remote(self): |
451 | class TestConnector: | 474 | class TestConnector: |