* refactor of renaming libraries in layer tests * 1. adds check for old API and new FE usafe 2. refactor of api_2 arg * fix for tf_NMS test preprocessing * take libs path from LD_LIBRARY_PATH env * convert str to Path object * use wheels path to libs * print lib paths * print lib paths * use ov_frontend_path env * also check if file to rename exists * removes redundant prints * copy instead of rename * 1. copy instead of rename 2. adds some details to readme
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
# Copyright (C) 2018-2022 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import inspect
|
|
import logging as log
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from common.layer_test_class import get_params
|
|
from common.utils.common_utils import copy_files_by_pattern
|
|
|
|
|
|
def pytest_generate_tests(metafunc):
|
|
test_gen_attrs_names = list(inspect.signature(get_params).parameters)
|
|
params = get_params()
|
|
metafunc.parametrize(test_gen_attrs_names, params, scope="function")
|
|
|
|
|
|
@pytest.fixture(scope='session', autouse=True)
|
|
def rename_tf_fe_libs(request):
|
|
if os.getenv('OV_FRONTEND_PATH'):
|
|
# use this env variable to define path to your specific libs
|
|
openvino_lib_path = Path(os.getenv('OV_FRONTEND_PATH'))
|
|
else:
|
|
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 "
|
|
"or use OV_FRONTEND_PATH env variable") from err
|
|
|
|
tf_fe_lib_names = ['libopenvino_tensorflow_fe', 'libopenvino_tensorflow_frontend']
|
|
|
|
if request.config.getoption('use_new_frontend'):
|
|
log.info('Using new frontend...')
|
|
copy_files_by_pattern(openvino_lib_path, tf_fe_lib_names[0], tf_fe_lib_names[1])
|