Skip to content

Commit

Permalink
Refactor work with env variables (#8208)
Browse files Browse the repository at this point in the history
* del MO_ROOT

* del MO_ROOT from common_utils.py

* add MO_PATH to common_utils.py

* change mo_path
  • Loading branch information
Victor Kuznetsov committed Nov 10, 2021
1 parent cfdc4c1 commit 852dd93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
8 changes: 0 additions & 8 deletions tests/layer_tests/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
import os


if 'MO_ROOT' in os.environ:
mo_bin = os.environ['MO_ROOT']
if not os.path.exists(mo_bin):
raise EnvironmentError(
"Environment variable MO_ROOT points to non existing path {}".format(mo_bin))
else:
raise EnvironmentError("MO_ROOT variable is not set")

if os.environ.get('OUTPUT_DIR') is not None:
out_path = os.environ['OUTPUT_DIR']
else:
Expand Down
14 changes: 7 additions & 7 deletions tests/layer_tests/common/utils/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
# SPDX-License-Identifier: Apache-2.0

import logging
import os
import subprocess
import sys
from pathlib import Path

import mo
import numpy as np


logger = logging.getLogger(__name__)


def generate_ir(coverage=False, **kwargs):
# Get default mo args
mo = os.path.join(os.environ.get("MO_ROOT"), "mo.py")
mo_path = Path(mo.__file__).parent
mo_runner = mo_path.joinpath('main.py').as_posix()
if coverage:
params = [sys.executable, '-m', 'coverage', 'run', '-p', '--source={}'.format(os.environ.get("MO_ROOT")),
'--omit=*_test.py', mo]
params = [sys.executable, '-m', 'coverage', 'run', '-p', '--source={}'.format(mo_path.parent),
'--omit=*_test.py', mo_runner]
else:
params = [sys.executable, mo]
params = [sys.executable, mo_runner]
for key, value in kwargs.items():
if key == "batch":
params.extend(("-b", str(value)))
Expand Down

0 comments on commit 852dd93

Please sign in to comment.