Skip to content

Commit

Permalink
adds utils folder
Browse files Browse the repository at this point in the history
  • Loading branch information
rnugmanx committed Oct 19, 2023
1 parent 2d1ddae commit e057c11
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 45 deletions.
2 changes: 1 addition & 1 deletion tests/e2e_oss/collect_irs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from shutil import copyfile

from e2e_oss.utils.test_utils import get_ir_tag, read_irs_mapping_file, write_irs_mapping_file, remove_mo_args_oob
from tests.utils.e2e.common.pipeline import Pipeline
from utils.e2e.common.pipeline import Pipeline

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/collect_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import logging as log
import os
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from tests.utils.e2e.common.pipeline import Pipeline
from utils.e2e.common.pipeline import Pipeline

pytest_plugins = ('e2e_oss.plugins.ref_collect.conftest', )

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e_oss/common_utils/e2e_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

# pylint: disable=wrong-import-position,wrong-import-order,import-error,unused-import,no-name-in-module

from tests.utils.e2e.env_tools import Environment
from tests.utils.e2e.ir_provider.model_optimizer_runner import MORunner
from tests.utils.e2e.ref_collector.score_pytorch_onnx_runtime import PytorchPretrainedToONNXRunner,\
from utils.e2e.env_tools import Environment
from utils.e2e.ir_provider.model_optimizer_runner import MORunner
from utils.e2e.ref_collector.score_pytorch_onnx_runtime import PytorchPretrainedToONNXRunner,\
PytorchTorchvisionToONNXRunner
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# import local modules:
from e2e_oss.utils.test_utils import align_output_name
from e2e_oss.common_utils.parsers import mapping_parser as mapping
from tests.utils.e2e.common.e2e_utils import get_tensor_names_dict
from tests.utils.e2e.env_tools import Environment
from utils.e2e.common.e2e_utils import get_tensor_names_dict
from utils.e2e.env_tools import Environment

log = getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e_oss/plugins/common/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import pytest
from jsonschema import validate, ValidationError

from tests.e2e_oss.utils.test_utils import copy_files_by_pattern, log_timestamp
from tests.utils.e2e.env_tools import Environment
from e2e_oss.utils.test_utils import copy_files_by_pattern, log_timestamp
from utils.e2e.env_tools import Environment


@contextmanager
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/plugins/e2e_test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from e2e_oss.common_utils.logger import get_logger
from e2e_oss.common_utils.marks import MarkRunType, MarkGeneral
from e2e_oss.common_utils.openvino_resources import OpenVINOResources, OpenVINOResourceNotFound
from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment

logger = get_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from e2e_oss.plugins.first_inference_tests.conftest import redefine_mo_out_path, get_non_infer_config
from e2e_oss.utils.test_utils import check_mo_precision
from tests.utils.e2e.common.pipeline import Pipeline
from utils.e2e.common.pipeline import Pipeline


def get_executable_cmd(args: dict):
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/plugins/first_inference_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory

from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment


def redefine_mo_out_path(instance, pipeline):
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/plugins/ref_collect/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from e2e_oss.common_utils.env_utils import fix_env_conf
from e2e_oss.common_utils.openvino_resources import OpenVINOResources, OpenVINOResourceNotFound
from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment


def set_env(metafunc):
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/plugins/reshape_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from e2e_oss.common_utils.env_utils import fix_env_conf
from e2e_oss.common_utils.openvino_resources import OpenVINOResources, OpenVINOResourceNotFound
from e2e_oss.plugins.e2e_test.conftest import satisfies_all_rules, unwrap_rules
from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment


@contextmanager
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e_oss/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
set_infer_precision_hint, remove_mo_args_oob, store_data_to_csv, timestamp
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from e2e_oss.common_utils.test_utils import get_shapes_from_data
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from tests.utils.e2e.env_tools import Environment
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.env_tools import Environment

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e_oss/test_auto_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
check_mo_precision
from e2e_oss.common_utils.test_utils import name_aligner
from e2e_oss.test import empty_dirs
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer

from e2e_oss.common_utils.logger import get_logger

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e_oss/test_compare_onnx_ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from e2e_oss.utils.path_utils import prepend_with_env_path
from e2e_oss.utils.test_utils import set_infer_precision_hint, read_irs_mapping_file, get_ir_tag
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/test_dynamism.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from e2e_oss.utils.modify_configs import dynamism_config, ie_reshape_config
from e2e_oss.utils.reshape_tests_utils import compare
from e2e_oss.utils.test_utils import set_infer_precision_hint, check_mo_precision, timestamp, get_static_shape
from tests.utils.e2e.common.pipeline import Pipeline
from utils.e2e.common.pipeline import Pipeline

pytest_plugins = ('e2e_oss.plugins.reshape_tests.conftest',)

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e_oss/test_legacy_fe.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from e2e_oss.utils.test_utils import check_mo_precision, set_infer_precision_hint, store_data_to_csv, \
log_timestamp
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from tests.utils.e2e.env_tools import Environment
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.env_tools import Environment

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e_oss/test_multi_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from e2e_oss.utils.test_utils import check_mo_precision, read_irs_mapping_file, get_ir_tag
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from e2e_oss.pipelines.pipeline_templates.comparators_template import eltwise_comparators
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e_oss/test_oob.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from e2e_oss.utils.test_utils import log_timestamp, check_mo_precision, set_infer_precision_hint, \
remove_mo_args_oob, store_data_to_csv, timestamp
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from tests.utils.e2e.env_tools import Environment
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.env_tools import Environment

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e_oss/test_ovc_mo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
set_infer_precision_hint, store_data_to_csv, timestamp
from e2e_oss.common_utils.logger import get_logger
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from tests.utils.e2e.env_tools import Environment
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.env_tools import Environment

pytest_plugins = 'e2e_oss.plugins.e2e_test.conftest'

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e_oss/test_platform_dependent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from e2e_oss.utils.test_utils import check_mo_precision, set_infer_precision_hint, store_data_to_csv, \
log_timestamp
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from tests.utils.e2e.env_tools import Environment
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.env_tools import Environment

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e_oss/test_skip_ir_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from e2e_oss.utils.modify_configs import get_original_model_importer_pipeline_config
from e2e_oss.utils.test_utils import log_timestamp, set_infer_precision_hint, store_data_to_csv, timestamp
from e2e_oss.common_utils.parsers import pipeline_cfg_to_string
from tests.utils.e2e.common.pipeline import Pipeline
from tests.utils.e2e.comparator.container import ComparatorsContainer
from tests.utils.e2e.env_tools import Environment
from utils.e2e.common.pipeline import Pipeline
from utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.env_tools import Environment

pytest_plugins = ('e2e_oss.plugins.e2e_test.conftest',)

Expand Down
8 changes: 4 additions & 4 deletions tests/e2e_oss/utils/path_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def is_writable(path: str):
def prepend_with_env_path(config_key, *paths):
"""Prepend given paths with base path specified in env_config.yml for given config_key"""
# Local import to avoid circular dependency
from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment
return Environment.abs_path(config_key, *paths)


def search_model_path_recursively(config_key, model_name):
from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment
search_pattern = Environment.abs_path(config_key) + '/**/' + model_name
path_found = list(iglob(search_pattern, recursive=True))
if len(path_found) == 1:
Expand Down Expand Up @@ -125,7 +125,7 @@ def is_locked(self):

def lock(self):
# Local import to avoid cyclic import
from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment
if self.writable:
if not self.is_locked():
log.info("Marking {} directory as locked".format(self.target_dir))
Expand All @@ -142,7 +142,7 @@ def lock(self):

def unlock(self):
# Local import to avoid cyclic import
from tests.utils.e2e.env_tools import Environment
from utils.e2e.env_tools import Environment
if self.is_locked():
self._lock_file.unlink()
if self.target_dir in Environment.locked_dirs:
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/utils/reshape_pipeline_executers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging as log

from e2e_oss.utils.modify_configs import ie_sbs_reshape_config, ie_reshape_config, mo_reshape_config
from tests.utils.e2e.common.pipeline import Pipeline
from utils.e2e.common.pipeline import Pipeline


def sbs_reshape_pipeline_runner(instance_ie_pipeline, shapes, test_name):
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e_oss/utils/reshape_tests_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from e2e_oss.utils.test_utils import replicator
from e2e_oss.common_utils.test_utils import name_aligner
from e2e_oss.pipelines.pipeline_templates.comparators_template import dummy_comparators, eltwise_comparators
from tests.utils.e2e.comparator.container import ComparatorsContainer
from utils.e2e.comparator.container import ComparatorsContainer


def should_run_reshape(instance) -> bool:
Expand Down
9 changes: 9 additions & 0 deletions tests/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

cmake_minimum_required(VERSION 3.13)

project(utils)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)

0 comments on commit e057c11

Please sign in to comment.