def tf_version_within_limit(metafunc_obj, image): """ Test all pytest fixtures for TensorFlow version limits, and return True if all requirements are satisfied :param metafunc_obj: pytest metafunc object from which fixture names used by test function will be obtained :param image: Image URI for which the validation must be performed :return: True if all validation succeeds, else False """ tf2_requirement_failed = "tf2_only" in metafunc_obj.fixturenames and not is_tf_version("2", image) tf24_requirement_failed = "tf24_and_above_only" in metafunc_obj.fixturenames and is_below_tf_version("2.4", image) tf21_requirement_failed = "tf21_and_above_only" in metafunc_obj.fixturenames and is_below_tf_version("2.1", image) if tf2_requirement_failed or tf21_requirement_failed or tf24_requirement_failed: return False return True
def framework_version_within_limit(metafunc_obj, image): """ Test all pytest fixtures for TensorFlow version limits, and return True if all requirements are satisfied :param metafunc_obj: pytest metafunc object from which fixture names used by test function will be obtained :param image: Image URI for which the validation must be performed :return: True if all validation succeeds, else False """ image_framework_name, _ = get_framework_and_version_from_tag(image) if image_framework_name == "tensorflow": tf2_requirement_failed = "tf2_only" in metafunc_obj.fixturenames and not is_tf_version( "2", image) tf24_requirement_failed = "tf24_and_above_only" in metafunc_obj.fixturenames and is_below_tf_version( "2.4", image) tf23_requirement_failed = "tf23_and_above_only" in metafunc_obj.fixturenames and is_below_tf_version( "2.3", image) tf21_requirement_failed = "tf21_and_above_only" in metafunc_obj.fixturenames and is_below_tf_version( "2.1", image) if tf2_requirement_failed or tf21_requirement_failed or tf24_requirement_failed or tf23_requirement_failed: return False if image_framework_name == "mxnet": mx18_requirement_failed = "mx18_and_above_only" in metafunc_obj.fixturenames and is_below_mxnet_version( "1.8", image) if mx18_requirement_failed: return False if image_framework_name == "pytorch": pt17_requirement_failed = "pt17_and_above_only" in metafunc_obj.fixturenames and is_below_pytorch_version( "1.7", image) if pt17_requirement_failed: return False return True