From aea5a772586280207111a1e33a5c62dec7254681 Mon Sep 17 00:00:00 2001 From: Fischer Moseley <42497969+fischermoseley@users.noreply.github.com> Date: Sun, 2 Apr 2023 20:38:34 -0400 Subject: [PATCH] blacken autogen test runner --- test/auto_gen/run_tests.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/test/auto_gen/run_tests.py b/test/auto_gen/run_tests.py index 3352553..3e5ec4c 100644 --- a/test/auto_gen/run_tests.py +++ b/test/auto_gen/run_tests.py @@ -8,44 +8,49 @@ from manta import Manta # Valid Configurations # test that they make a python API without errors -# test that their verilog passes lint +# TODO: test that their verilog passes lint print(" ==== Testing valid configurations ====") -valid_configs_path = 'test/auto_gen/valid_configs/' +valid_configs_path = "test/auto_gen/valid_configs/" for config_file in sorted(listdir(valid_configs_path)): caught_exception = None try: m = Manta(valid_configs_path + config_file) - + except Exception as e: caught_exception = e - + if caught_exception is None: - print(f" -> config file {config_file} raised no exceptions.") - + print(f" -> no exceptions correctly raised by config file {config_file}") + else: - raise RuntimeError(f"Configuration {config_file} shouldn't have raised an exception, but raised {caught_exception}") + raise RuntimeError( + f"Configuration {config_file} shouldn't have raised an exception, but raised {caught_exception}" + ) - -print('\n') +print("\n") # Invalid Configurations # test that they throw errors when generating a python API print(" ==== Testing invalid configurations ====") -invalid_configs_path = 'test/auto_gen/invalid_configs/' +invalid_configs_path = "test/auto_gen/invalid_configs/" for config_file in sorted(listdir(invalid_configs_path)): caught_exception = None try: m = Manta(invalid_configs_path + config_file) - + except Exception as e: caught_exception = e - if caught_exception is not None: - print(f" -> config file {config_file} raised the following exception: {caught_exception}") - + if caught_exception is not None: + print( + f" -> exception correctly raised by config file {config_file}: {caught_exception}" + ) + else: - raise RuntimeError(f"Configuration {config_file} should have raised an exception, but did not!") + raise RuntimeError( + f"Configuration {config_file} should have raised an exception, but did not!" + )