aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-04-27 17:41:25 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2022-05-01 13:41:31 +0300
commit9b94045170d499faf598e790c055e371e9c24437 (patch)
treea46135e37fcdde580bad469548a52439ffb3c953
parente201b87dd5283b010b78c315ae0cccecfa8b38f7 (diff)
downloadmeson-9b94045170d499faf598e790c055e371e9c24437.zip
meson-9b94045170d499faf598e790c055e371e9c24437.tar.gz
meson-9b94045170d499faf598e790c055e371e9c24437.tar.bz2
another day, another mypy update becomes stricter about typing
Move GlobalState to a runtime T.NamedTuple, use it for constructing the tuple we are passing around rather than expecting mypy to detect that the one we already have matches.
-rwxr-xr-xrun_project_tests.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index b25aca6..c37d10e 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -82,20 +82,6 @@ if T.TYPE_CHECKING:
no_unittests: bool
only: T.List[str]
- # In previous python versions the global variables are lost in ProcessPoolExecutor.
- # So, we use this tuple to restore some of them
- class GlobalState(T.NamedTuple):
- compile_commands: T.List[str]
- clean_commands: T.List[str]
- test_commands: T.List[str]
- install_commands: T.List[str]
- uninstall_commands: T.List[str]
-
- backend: 'Backend'
- backend_flags: T.List[str]
-
- host_c_compiler: T.Optional[str]
-
ALL_TESTS = ['cmake', 'common', 'native', 'warning-meson', 'failing-meson', 'failing-build', 'failing-test',
'keyval', 'platform-osx', 'platform-windows', 'platform-linux',
'java', 'C#', 'vala', 'cython', 'rust', 'd', 'objective c', 'objective c++',
@@ -602,6 +588,20 @@ def detect_parameter_files(test: TestDef, test_build_dir: str) -> T.Tuple[Path,
return nativefile, crossfile
+# In previous python versions the global variables are lost in ProcessPoolExecutor.
+# So, we use this tuple to restore some of them
+class GlobalState(T.NamedTuple):
+ compile_commands: T.List[str]
+ clean_commands: T.List[str]
+ test_commands: T.List[str]
+ install_commands: T.List[str]
+ uninstall_commands: T.List[str]
+
+ backend: 'Backend'
+ backend_flags: T.List[str]
+
+ host_c_compiler: T.Optional[str]
+
def run_test(test: TestDef,
extra_args: T.List[str],
should_fail: str,
@@ -1200,7 +1200,7 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
print(f'\nRunning tests with {num_workers} workers')
# Pack the global state
- state = (compile_commands, clean_commands, test_commands, install_commands, uninstall_commands, backend, backend_flags, host_c_compiler)
+ state = GlobalState(compile_commands, clean_commands, test_commands, install_commands, uninstall_commands, backend, backend_flags, host_c_compiler)
executor = ProcessPoolExecutor(max_workers=num_workers)
futures: T.List[RunFutureUnion] = []