From: Hood Chatham Date: Thu, 19 Mar 2026 22:14:13 +0000 (+0100) Subject: gh-145177: Add emscripten run --test, uses test args from config.toml (#146160) X-Git-Tag: v3.15.0a8~241 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b5511d66bab0754d1d959cfe98947c536bf4d82;p=thirdparty%2FPython%2Fcpython.git gh-145177: Add emscripten run --test, uses test args from config.toml (#146160) This allows us to change the test arguments from the python repo rather than having to change buildmaster-config. Co-authored-by: Russell Keith-Magee --- diff --git a/Platforms/emscripten/__main__.py b/Platforms/emscripten/__main__.py index 98e5731be96a..6a7963413da3 100644 --- a/Platforms/emscripten/__main__.py +++ b/Platforms/emscripten/__main__.py @@ -578,7 +578,10 @@ def run_emscripten_python(context): if args and args[0] == "--": args = args[1:] - os.execv(str(exec_script), [str(exec_script)] + args) + if context.test: + args = load_config_toml()["test-args"] + args + + os.execv(str(exec_script), [str(exec_script), *args]) def build_target(context): @@ -695,6 +698,15 @@ def main(): "run", help="Run the built emscripten Python", ) + run.add_argument( + "--test", + action="store_true", + default=False, + help=( + "If passed, will add the default test arguments to the beginning of the command. " + "Default arguments loaded from Platforms/emscripten/config.toml" + ) + ) run.add_argument( "args", nargs=argparse.REMAINDER, @@ -704,6 +716,7 @@ def main(): ) ) add_cross_build_dir_option(run) + clean = subcommands.add_parser( "clean", help="Delete files and directories created by this script" ) diff --git a/Platforms/emscripten/config.toml b/Platforms/emscripten/config.toml index 4e76b5bf9f7d..c474078fb48b 100644 --- a/Platforms/emscripten/config.toml +++ b/Platforms/emscripten/config.toml @@ -3,6 +3,14 @@ # Python versions. emscripten-version = "4.0.12" node-version = "24" +test-args = [ + "-m", "test", + "-v", + "-uall", + "--rerun", + "--single-process", + "-W", +] [libffi] url = "https://github.com/libffi/libffi/releases/download/v{version}/libffi-{version}.tar.gz"