MODELS_ROOT_DIR = _get_default_additional_models_dir()

zoo_models = []
# rglob doesn't work for symlinks, so models have to be physically somwhere inside "MODELS_ROOT_DIR"
for path in Path(MODELS_ROOT_DIR).rglob("*.onnx"):
    mdir, file = os.path.split(str(path))
    if not file.startswith("."):
        zoo_models.append({
            "model_name": path,
            "model_file": file,
            "dir": str(mdir)
        })

if len(zoo_models) > 0:
    sorted(zoo_models, key=itemgetter("model_name"))

    # Set backend device name to be used instead of hardcoded by ONNX BackendTest class ones.
    OpenVinoOnnxBackend.backend_name = tests.BACKEND_NAME

    # import all test cases at global scope to make them visible to pytest
    backend_test = ModelImportRunner(OpenVinoOnnxBackend, zoo_models, __name__)
    test_cases = backend_test.test_cases[
        "OnnxBackendValidationModelImportTest"]
    del test_cases

    test_cases = backend_test.test_cases[
        "OnnxBackendValidationModelExecutionTest"]
    del test_cases

    globals().update(backend_test.enable_report().test_cases)