diff --git a/test/externalTests/exttest/common.py b/test/externalTests/exttest/common.py index 53a1525e9847..8fcb44ca693c 100644 --- a/test/externalTests/exttest/common.py +++ b/test/externalTests/exttest/common.py @@ -87,12 +87,15 @@ def __post_init__(self): def selected_presets(self): return self.compile_only_presets + self.settings_presets + class InvalidConfigError(Exception): pass + class WrongBinaryType(Exception): pass + class TestRunner(metaclass=ABCMeta): @staticmethod def on_local_test_dir(fn): @@ -213,7 +216,9 @@ def parse_solc_version(solc_version_string): if solc_version_match: solc_full_version = solc_version_match.group(1) else: - raise RuntimeError(f"Solc version could not be found in: {solc_version_string}.") + raise RuntimeError( + f"Solc version could not be found in: {solc_version_string}." + ) return solc_full_version @@ -253,8 +258,10 @@ def setup_solc(config: TestConfig, test_dir: Path) -> (str, str): run_cmd("npm install") run_cmd("npm run build") - if mimetypes.guess_type(sc_config.binary_path)[0] != 'application/javascript': - raise WrongBinaryType(f"Provided soljson.js is expected to be of the type application/javascript but it is not.") + if mimetypes.guess_type(sc_config.binary_path)[0] != "application/javascript": + raise WrongBinaryType( + f"Provided soljson.js is expected to be of the type application/javascript but it is not." + ) copyfile(sc_config.binary_path, solc_dir / "dist/soljson.js") solc_version_output = subprocess.getoutput(f"node {solc_bin} --version") diff --git a/test/externalTests/prb-math.py b/test/externalTests/prb-math.py index 7fc238778d03..7a6c043c433a 100755 --- a/test/externalTests/prb-math.py +++ b/test/externalTests/prb-math.py @@ -33,28 +33,30 @@ try: args = parse_command_line("PRBMath external tests", sys.argv[1:]) - runner_config = TestConfig(**{ - "repo_url": "https://github.com/PaulRBerg/prb-math.git", - "ref_type": "branch", - "ref": "main", - "config_file": "foundry.toml", - "config_var": "config", - "build_dependency": "rust", - "compile_only_presets": [], - "settings_presets": [ - "ir-optimize-evm+yul", - "legacy-optimize-evm-only", - "legacy-optimize-evm+yul", - "legacy-no-optimize" - ], - "evm_version": f"{CURRENT_EVM_VERSION}", - "solc": { - "binary_type": f"{args.solc_binary_type}", - "binary_path": f"{args.solc_binary_path}", - "branch": "master", - "install_dir": "solc/" + runner_config = TestConfig( + **{ + "repo_url": "https://github.com/PaulRBerg/prb-math.git", + "ref_type": "branch", + "ref": "main", + "config_file": "foundry.toml", + "config_var": "config", + "build_dependency": "rust", + "compile_only_presets": [], + "settings_presets": [ + "ir-optimize-evm+yul", + "legacy-optimize-evm-only", + "legacy-optimize-evm+yul", + "legacy-no-optimize", + ], + "evm_version": f"{CURRENT_EVM_VERSION}", + "solc": { + "binary_type": f"{args.solc_binary_type}", + "binary_path": f"{args.solc_binary_path}", + "branch": "master", + "install_dir": "solc/", + }, } - }) + ) run_test( "PRBMath", @@ -65,8 +67,6 @@ test_fn=None, ), ) - except ( - InvalidConfigError - ) as exception: + except InvalidConfigError as exception: print(f"Error while processing test: {exception}", file=sys.stderr) sys.exit(1)