def test_pos_guarded_apply(self, patchqueue, guard): """Positively guarded patches are applied if guard is selected""" series = patchqueue.series().splitlines(True) applied = list(planex.patchqueue.parse_patchseries(series, guard)) expected = [p.patch.name for p in patchqueue.patches if tst.Guard("+", guard) in p.guards] self.assertTrue(all([p in applied for p in expected]))
def test_pos_guarded_skip(self, patchqueue, guard): """Positively-guarded patches are skipped if guard is not selected""" series = patchqueue.series().splitlines(True) applied = list(planex.patchqueue.parse_patchseries(series, guard)) not_expected = [p.patch.name for p in patchqueue.patches if p.has_positive_guards() and tst.Guard('+', guard) not in p.guards] self.assertTrue(all([p not in applied for p in not_expected]))
def test_neg_guarded_apply(self, patchqueue, guard): """Negatively-guarded patches are applied if guard is not selected""" series = patchqueue.series().splitlines(True) applied = list(planex.patchqueue.parse_patchseries(series, guard)) expected = [p.patch.name for p in patchqueue.patches if p.has_negative_guards() and tst.Guard('-', guard) not in p.guards] self.assertTrue(all([p in applied for p in expected]))
def test_application_order(self, patchqueue, guard): """Patches are applied in patchqueue order""" series = patchqueue.series().splitlines(True) applied = list(planex.patchqueue.parse_patchseries(series, guard)) # Filter unapplied patches out of the patchqueue, yielding a list # of applied patches in patchqueue order expected_inorder = [p.patch.name for p in patchqueue.patches if p.patch.name in applied] self.assertEqual(applied, expected_inorder)
def test_unguarded(self, patchqueue, guard): """Unguarded patches are always applied""" series = patchqueue.series().splitlines(True) applied = list(planex.patchqueue.parse_patchseries(series, guard)) expected = [p.patch.name for p in patchqueue.patches if not p.guards] self.assertTrue(all([p in applied for p in expected]))