Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
Acribbs committed Apr 4, 2024
1 parent cc1b71e commit 8835c5a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -84,13 +86,15 @@ 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
kwargs.update({'return_parser': True})
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]
Expand All @@ -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
Expand Down Expand Up @@ -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."
Expand Down

0 comments on commit 8835c5a

Please sign in to comment.