diff options
| -rw-r--r-- | mesonbuild/interpreter/kwargs.py | 5 | ||||
| -rw-r--r-- | mesonbuild/interpreter/type_checking.py | 9 | ||||
| -rw-r--r-- | mesonbuild/modules/rust.py | 1 |
3 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py index 61cff9aea..c0b74405f 100644 --- a/mesonbuild/interpreter/kwargs.py +++ b/mesonbuild/interpreter/kwargs.py @@ -19,6 +19,9 @@ from ..modules.cmake import CMakeSubprojectOptions from ..programs import ExternalProgram from .type_checking import PkgConfigDefineType, SourcesVarargsType +if T.TYPE_CHECKING: + TestArgs = T.Union[str, File, build.Target, ExternalProgram] + class FuncAddProjectArgs(TypedDict): """Keyword Arguments for the add_*_arguments family of arguments. @@ -38,7 +41,6 @@ class BaseTest(TypedDict): """Shared base for the Rust module.""" - args: T.List[T.Union[str, File, build.Target, ExternalProgram]] should_fail: bool timeout: int workdir: T.Optional[str] @@ -52,6 +54,7 @@ class FuncBenchmark(BaseTest): """Keyword Arguments shared between `test` and `benchmark`.""" + args: T.List[TestArgs] protocol: Literal['exitcode', 'tap', 'gtest', 'rust'] diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index 6519258b9..1c9953ee4 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -472,9 +472,7 @@ VARIABLES_KW: KwargInfo[T.Dict[str, str]] = KwargInfo( PRESERVE_PATH_KW: KwargInfo[bool] = KwargInfo('preserve_path', bool, default=False, since='0.63.0') -TEST_KWS: T.List[KwargInfo] = [ - KwargInfo('args', ContainerTypeInfo(list, (str, File, BuildTarget, CustomTarget, CustomTargetIndex, ExternalProgram)), - listify=True, default=[]), +TEST_KWS_NO_ARGS: T.List[KwargInfo] = [ KwargInfo('should_fail', bool, default=False), KwargInfo('timeout', int, default=30), KwargInfo('workdir', (str, NoneType), default=None, @@ -491,6 +489,11 @@ TEST_KWS: T.List[KwargInfo] = [ KwargInfo('verbose', bool, default=False, since='0.62.0'), ] +TEST_KWS: T.List[KwargInfo] = TEST_KWS_NO_ARGS + [ + KwargInfo('args', ContainerTypeInfo(list, (str, File, BuildTarget, CustomTarget, CustomTargetIndex, ExternalProgram)), + listify=True, default=[]), +] + # Cannot have a default value because we need to check that rust_crate_type and # rust_abi are mutually exclusive. RUST_CRATE_TYPE_KW: KwargInfo[T.Union[str, None]] = KwargInfo( diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py index 873bc8929..70b206032 100644 --- a/mesonbuild/modules/rust.py +++ b/mesonbuild/modules/rust.py @@ -37,6 +37,7 @@ if T.TYPE_CHECKING: class FuncTest(_kwargs.BaseTest): + args: T.List[_kwargs.TestArgs] dependencies: T.List[T.Union[Dependency, ExternalLibrary]] is_parallel: bool link_with: T.List[LibTypes] |
