diff --git a/tests/test_commandline.py b/tests/test_commandline.py index 9f6163ac..0feb1d95 100644 --- a/tests/test_commandline.py +++ b/tests/test_commandline.py @@ -60,10 +60,12 @@ # Filename for the black/white list of options FILENAME_OPTIONLIST = "tests/option_list.tsv" + class DummyError(Exception): """Custom exception for controlling test flow.""" pass + def filter_files(files): '''Filter list of files according to filters set in the configuration file tests/_test_commandline.yml''' testing_dir = TestUtils.get_tests_directory() @@ -84,6 +86,7 @@ def filter_files(files): files = list(filter(rx.search, files)) return files + def LocalStart(parser, *args, **kwargs): '''Stub for E.start - captures the parser for inspection.''' global PARSER @@ -91,6 +94,7 @@ def LocalStart(parser, *args, **kwargs): PARSER = ORIGINAL_START(parser, **kwargs) raise DummyError() + def load_script(script_name): '''Attempts to import a script as a module for inspection.''' script_path = os.path.splitext(script_name)[0] @@ -110,6 +114,7 @@ def load_script(script_name): return module, module_name + def test_cmdline(): '''Test command line interfaces of scripts for style and conformity.''' global ORIGINAL_START @@ -167,6 +172,7 @@ def test_cmdline(): if module_name in sys.modules: del sys.modules[module_name] + def check_option(option, script_name, option_actions): print(f"Checking option: {option} in script: {script_name}") # Diagnostic print assert option in option_actions, f"Option {option} in script {script_name} is unknown or not allowed."