diff --git a/checkbox-ng/plainbox/impl/unit/test_testplan.py b/checkbox-ng/plainbox/impl/unit/test_testplan.py index 73d76b4d3..850c6228a 100644 --- a/checkbox-ng/plainbox/impl/unit/test_testplan.py +++ b/checkbox-ng/plainbox/impl/unit/test_testplan.py @@ -508,3 +508,30 @@ def test_nested_tesplan__multiple_namespaces(self): self.assertIsInstance(qual_list[1].matcher, OperatorMatcher) self.assertEqual(qual_list[1].matcher.value, 'ns2::Bar') self.assertEqual(qual_list[1].inclusive, True) + + +class TestTestPlanUnitSupport(TestCase): + + def setUp(self): + self.provider1 = mock.Mock(name='provider1', spec_set=IProvider1) + self.provider1.namespace = 'ns1' + self.tp1 = TestPlanUnit({ + "id": "tp1", + "unit": "test plan", + "name": "An example test plan 1", + "mandatory_include": "mandatory_job certification_status=blocker", + "include": "job1 certification_status=non-blocker", + }, provider=self.provider1) + self.provider1.unit_list = [] + self.tp1.provider_list = [self.provider1,] + self.provider1.unit_list.append(self.tp1) + + def test_inline_override(self): + support = TestPlanUnitSupport(self.tp1) + self.assertEqual( + support.override_list, + [ + ("^ns1::job1$", [("certification_status", "non-blocker")]), + ("^ns1::mandatory_job$", [("certification_status", "blocker")]) + ] + ) diff --git a/checkbox-ng/plainbox/impl/unit/testplan.py b/checkbox-ng/plainbox/impl/unit/testplan.py index 96b5c9ae3..307665c1e 100644 --- a/checkbox-ng/plainbox/impl/unit/testplan.py +++ b/checkbox-ng/plainbox/impl/unit/testplan.py @@ -843,6 +843,8 @@ def visit_IncludeStmt_node(self, node: IncludeStmt): override_list.append((pattern, field_value_list)) V().visit(IncludeStmtList.parse(testplan.include)) + if testplan.mandatory_include: + V().visit(IncludeStmtList.parse(testplan.mandatory_include)) for tp_unit in testplan.get_nested_part(): override_list.extend(self._get_inline_overrides(tp_unit)) return override_list