Allow unit test to parse testcase blocks

When a unittest introspect a meson.build file from a test case,
the file may contain a testcase block. We should ignore this block.
1.2
Charles Brunet 1 year ago committed by Nirbheek Chauhan
parent ca42c7029f
commit c30df902e1
  1. 5
      mesonbuild/ast/interpreter.py

@ -29,6 +29,7 @@ from ..interpreterbase import (
InvalidArguments, InvalidArguments,
BreakRequest, BreakRequest,
ContinueRequest, ContinueRequest,
Disabler,
default_resolve_key, default_resolve_key,
) )
@ -53,6 +54,7 @@ from ..mparser import (
NotNode, NotNode,
PlusAssignmentNode, PlusAssignmentNode,
TernaryNode, TernaryNode,
TestCaseClauseNode,
) )
if T.TYPE_CHECKING: if T.TYPE_CHECKING:
@ -445,3 +447,6 @@ class AstInterpreter(InterpreterBase):
elif isinstance(val, (str, bool, int, float)) or include_unknown_args: elif isinstance(val, (str, bool, int, float)) or include_unknown_args:
flattened_kwargs[key] = val flattened_kwargs[key] = val
return flattened_kwargs return flattened_kwargs
def evaluate_testcase(self, node: TestCaseClauseNode) -> Disabler | None:
return Disabler(subproject=self.subproject)

Loading…
Cancel
Save