From 7a661257b6adad0c8f53e32b42ced56a1e7d952f Mon Sep 17 00:00:00 2001 From: Benjamin Klimczak Date: Thu, 2 Feb 2023 14:02:05 +0000 Subject: MLIA-769 Expand use of target/backend registries - Use the target/backend registries to avoid hard-coded names. - Cache target profiles to avoid re-loading them Change-Id: I474b7c9ef23894e1d8a3ea06d13a37652054c62e --- tests/test_cli_command_validators.py | 57 ++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 32 deletions(-) (limited to 'tests/test_cli_command_validators.py') diff --git a/tests/test_cli_command_validators.py b/tests/test_cli_command_validators.py index cd048ee..29813f4 100644 --- a/tests/test_cli_command_validators.py +++ b/tests/test_cli_command_validators.py @@ -5,7 +5,6 @@ from __future__ import annotations import argparse from contextlib import ExitStack -from unittest.mock import MagicMock import pytest @@ -93,72 +92,66 @@ def test_validate_check_target_profile( @pytest.mark.parametrize( - "input_target_profile, input_backends, throws_exception," - "exception_message, output_backends", + ( + "input_target_profile", + "input_backends", + "throws_exception", + "exception_message", + "output_backends", + ), [ [ "tosa", - ["Vela"], - True, - "Vela backend not supported with target-profile tosa.", + ["tosa-checker"], + False, None, + ["tosa-checker"], ], [ "tosa", - ["Corstone-300, Vela"], + ["Corstone-310"], True, - "Corstone-300, Vela backend not supported with target-profile tosa.", + "Backend Corstone-310 not supported with target-profile tosa.", None, ], [ "cortex-a", - ["Corstone-310", "tosa-checker"], - True, - "Corstone-310, tosa-checker backend not supported " - "with target-profile cortex-a.", + ["ArmNNTFLiteDelegate"], + False, None, + ["ArmNNTFLiteDelegate"], ], [ - "ethos-u55-256", - ["tosa-checker", "Corstone-310"], + "cortex-a", + ["tosa-checker"], True, - "tosa-checker backend not supported with target-profile ethos-u55-256.", + "Backend tosa-checker not supported with target-profile cortex-a.", None, ], - ["tosa", None, False, None, ["tosa-checker"]], - ["cortex-a", None, False, None, ["ArmNNTFLiteDelegate"]], - ["tosa", ["tosa-checker"], False, None, ["tosa-checker"]], - ["cortex-a", ["ArmNNTFLiteDelegate"], False, None, ["ArmNNTFLiteDelegate"]], [ "ethos-u55-256", - ["Vela", "Corstone-300"], + ["Vela", "Corstone-310"], False, None, - ["Vela", "Corstone-300"], + ["Vela", "Corstone-310"], ], [ - "ethos-u55-256", - None, - False, + "ethos-u65-256", + ["Vela", "Corstone-310", "tosa-checker"], + True, + "Backend tosa-checker not supported with target-profile ethos-u65-256.", None, - ["Vela", "Corstone-300"], ], ], ) def test_validate_backend( - monkeypatch: pytest.MonkeyPatch, input_target_profile: str, - input_backends: list[str] | None, + input_backends: list[str], throws_exception: bool, exception_message: str, output_backends: list[str] | None, ) -> None: """Test backend validation with target-profiles and backends.""" - monkeypatch.setattr( - "mlia.cli.config.get_available_backends", - MagicMock(return_value=["Vela", "Corstone-300"]), - ) - exit_stack = ExitStack() if throws_exception: exit_stack.enter_context( -- cgit v1.2.1