2023-01-16 11:02:17 +04:00
|
|
|
# Copyright (C) 2018-2023 Intel Corporation
|
2021-06-16 12:50:16 +03:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
|
|
import inspect
|
2022-08-30 13:51:03 +04:00
|
|
|
import logging as log
|
2022-09-20 13:43:37 +04:00
|
|
|
import os
|
2022-08-30 13:51:03 +04:00
|
|
|
from pathlib import Path
|
2021-06-16 12:50:16 +03:00
|
|
|
|
2022-08-30 13:51:03 +04:00
|
|
|
import pytest
|
2021-06-16 12:50:16 +03:00
|
|
|
from common.layer_test_class import get_params
|
2022-09-20 13:43:37 +04:00
|
|
|
from common.utils.common_utils import copy_files_by_pattern
|
2022-08-30 13:51:03 +04:00
|
|
|
|
2021-06-16 12:50:16 +03:00
|
|
|
|
|
|
|
|
def pytest_generate_tests(metafunc):
|
|
|
|
|
test_gen_attrs_names = list(inspect.signature(get_params).parameters)
|
|
|
|
|
params = get_params()
|
2022-12-23 03:44:44 +01:00
|
|
|
setattr(metafunc.cls, 'tflite', metafunc.config.getoption('tflite'))
|
2021-06-16 12:50:16 +03:00
|
|
|
metafunc.parametrize(test_gen_attrs_names, params, scope="function")
|
2022-08-30 13:51:03 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope='session', autouse=True)
|
|
|
|
|
def rename_tf_fe_libs(request):
|
2023-02-02 08:19:35 +04:00
|
|
|
try:
|
|
|
|
|
import openvino.runtime as rt
|
|
|
|
|
# path below is built considering the use of wheels
|
|
|
|
|
openvino_lib_path = Path(rt.__file__).parent.parent / 'libs'
|
|
|
|
|
except ImportError as err:
|
|
|
|
|
raise Exception("Please set PYTHONPATH to OpenVINO Python or install wheel package") from err
|
2022-09-20 13:43:37 +04:00
|
|
|
|
|
|
|
|
tf_fe_lib_names = ['libopenvino_tensorflow_fe', 'libopenvino_tensorflow_frontend']
|
2022-08-30 13:51:03 +04:00
|
|
|
|
|
|
|
|
if request.config.getoption('use_new_frontend'):
|
|
|
|
|
log.info('Using new frontend...')
|
2022-09-20 13:43:37 +04:00
|
|
|
copy_files_by_pattern(openvino_lib_path, tf_fe_lib_names[0], tf_fe_lib_names[1])
|