def test_parse_recipe(self): with bb.tinfoil.Tinfoil() as tinfoil: tinfoil.prepare(config_only=False, quiet=2) testrecipe = 'mdadm' best = tinfoil.find_best_provider(testrecipe) if not best: self.fail('Unable to find recipe providing %s' % testrecipe) rd = tinfoil.parse_recipe_file(best[3]) self.assertEqual(testrecipe, rd.getVar('PN'))
def test_parse_recipe_initial_datastore(self): with bb.tinfoil.Tinfoil() as tinfoil: tinfoil.prepare(config_only=False, quiet=2) testrecipe = 'mdadm' best = tinfoil.find_best_provider(testrecipe) if not best: self.fail('Unable to find recipe providing %s' % testrecipe) dcopy = bb.data.createCopy(tinfoil.config_data) dcopy.setVar('MYVARIABLE', 'somevalue') rd = tinfoil.parse_recipe_file(best[3], config_data=dcopy) # Check we can get variable values self.assertEqual('somevalue', rd.getVar('MYVARIABLE'))
def test_parse_recipe_copy_expand(self): with bb.tinfoil.Tinfoil() as tinfoil: tinfoil.prepare(config_only=False, quiet=2) testrecipe = 'mdadm' best = tinfoil.find_best_provider(testrecipe) if not best: self.fail('Unable to find recipe providing %s' % testrecipe) rd = tinfoil.parse_recipe_file(best[3]) # Check we can get variable values self.assertEqual(testrecipe, rd.getVar('PN')) # Check that expanding a value that includes a variable reference works self.assertEqual(testrecipe, rd.getVar('BPN')) # Now check that changing the referenced variable's value in a copy gives that # value when expanding localdata = bb.data.createCopy(rd) localdata.setVar('PN', 'hello') self.assertEqual('hello', localdata.getVar('BPN'))