Skip to content

testing.module_run_tests

PyTest suite for testing if run.py is aligned with module specification:

if_arguments_from_module_spec_match_script_argparse(module)

Tests alignment between module_spec arguments and script parser arguments

Source code in shrike/pipeline/testing/module_run_tests.py
def if_arguments_from_module_spec_match_script_argparse(module):
    """Tests alignment between module_spec arguments and script parser arguments"""
    if_arguments_from_component_spec_match_script_argparse(
        os.path.join(module, "module_spec.yaml")
    )

module_run_get_arg_parser(module)

Tests is module run.py has function get_arg_parser(parser)

Source code in shrike/pipeline/testing/module_run_tests.py
def module_run_get_arg_parser(module):
    """Tests is module run.py has function get_arg_parser(parser)"""
    component_run_get_arg_parser(os.path.join(module, "module_spec.yaml"))

module_spec_yaml_exists_and_is_parsable(module)

Tests the presence of module specifications in yaml (and return it)

Source code in shrike/pipeline/testing/module_run_tests.py
def module_spec_yaml_exists_and_is_parsable(module):
    """Tests the presence of module specifications in yaml (and return it)"""
    return component_spec_yaml_exists_and_is_parsable(
        os.path.join(module, "module_spec.yaml")
    )

module_uses_private_acr(module, acr_url)

Tests base image in private ACR

Source code in shrike/pipeline/testing/module_run_tests.py
def module_uses_private_acr(module, acr_url):
    """Tests base image in private ACR"""
    component_uses_private_acr(os.path.join(module, "module_spec.yaml"), acr_url)

module_uses_private_python_feed(module, feed_url)

Tests private python feed referenced in conda

Source code in shrike/pipeline/testing/module_run_tests.py
def module_uses_private_python_feed(module, feed_url):
    """Tests private python feed referenced in conda"""
    component_uses_private_python_feed(
        os.path.join(module, "module_spec.yaml"), feed_url
    )

run_py_import(module)

Try importing run.py, just to check if basic script passes syntax/imports checks

Source code in shrike/pipeline/testing/module_run_tests.py
def run_py_import(module):
    """Try importing run.py, just to check if basic script passes syntax/imports checks"""
    component_run_py_import(os.path.join(module, "module_spec.yaml"))