diff options
author | exprmntr <exprmntr@yandex-team.ru> | 2022-02-10 16:46:50 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:50 +0300 |
commit | a6396ea4e82c2605dcf9a11ebc4c289d0b1c734c (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/python/testing/yatest_common/yatest/common | |
parent | 078ddb2fb76387cae14e8c3ceb5a896009a5a539 (diff) | |
download | ydb-a6396ea4e82c2605dcf9a11ebc4c289d0b1c734c.tar.gz |
Restoring authorship annotation for exprmntr <exprmntr@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/testing/yatest_common/yatest/common')
7 files changed, 69 insertions, 69 deletions
diff --git a/library/python/testing/yatest_common/yatest/common/__init__.py b/library/python/testing/yatest_common/yatest/common/__init__.py index 41661c6fbf..cf57779e27 100644 --- a/library/python/testing/yatest_common/yatest/common/__init__.py +++ b/library/python/testing/yatest_common/yatest/common/__init__.py @@ -2,7 +2,7 @@ from .benchmark import * # noqa from .canonical import * # noqa from .errors import * # noqa from .misc import * # noqa -from .path import * # noqa -from .process import * # noqa +from .path import * # noqa +from .process import * # noqa from .runtime import * # noqa -from .tags import * # noqa +from .tags import * # noqa diff --git a/library/python/testing/yatest_common/yatest/common/benchmark.py b/library/python/testing/yatest_common/yatest/common/benchmark.py index d664aa389d..c3784cbe4c 100644 --- a/library/python/testing/yatest_common/yatest/common/benchmark.py +++ b/library/python/testing/yatest_common/yatest/common/benchmark.py @@ -1,7 +1,7 @@ import json -from . import process -from . import runtime +from . import process +from . import runtime def execute_benchmark(path, budget=None, threads=None): diff --git a/library/python/testing/yatest_common/yatest/common/canonical.py b/library/python/testing/yatest_common/yatest/common/canonical.py index b684604edd..b6a136d3e9 100644 --- a/library/python/testing/yatest_common/yatest/common/canonical.py +++ b/library/python/testing/yatest_common/yatest/common/canonical.py @@ -5,9 +5,9 @@ import tempfile import six -from . import process -from . import runtime -from . import path +from . import process +from . import runtime +from . import path yatest_logger = logging.getLogger("ya.test") diff --git a/library/python/testing/yatest_common/yatest/common/errors.py b/library/python/testing/yatest_common/yatest/common/errors.py index 22320b79c7..8c038fc381 100644 --- a/library/python/testing/yatest_common/yatest/common/errors.py +++ b/library/python/testing/yatest_common/yatest/common/errors.py @@ -5,7 +5,7 @@ import sys class RestartTestException(Exception): def __init__(self, *args, **kwargs): - super(RestartTestException, self).__init__(*args, **kwargs) + super(RestartTestException, self).__init__(*args, **kwargs) sys.stderr.write("##restart-test##\n") sys.stderr.flush() os.environ["FORCE_EXIT_TESTSFAILED"] = "1" @@ -14,7 +14,7 @@ class RestartTestException(Exception): class InfrastructureException(Exception): def __init__(self, *args, **kwargs): - super(InfrastructureException, self).__init__(*args, **kwargs) + super(InfrastructureException, self).__init__(*args, **kwargs) sys.stderr.write("##infrastructure-error##\n") sys.stderr.flush() os.environ["FORCE_EXIT_TESTSFAILED"] = "1" diff --git a/library/python/testing/yatest_common/yatest/common/legacy.py b/library/python/testing/yatest_common/yatest/common/legacy.py index 655aa81b44..459972d253 100644 --- a/library/python/testing/yatest_common/yatest/common/legacy.py +++ b/library/python/testing/yatest_common/yatest/common/legacy.py @@ -1,4 +1,4 @@ -from . import canonical +from . import canonical def old_canonical_file(output_file_name, storage_md5): diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index 94dbd074a4..a8bcc21f51 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -19,9 +19,9 @@ try: except ImportError: cores = None -from . import runtime -from . import path -from . import environment +from . import runtime +from . import path +from . import environment MAX_OUT_LEN = 1000 * 1000 # 1 mb @@ -48,11 +48,11 @@ class ExecutionError(Exception): def __init__(self, execution_result): if not isinstance(execution_result.command, six.string_types): - command = " ".join(str(arg) for arg in execution_result.command) - else: - command = execution_result.command + command = " ".join(str(arg) for arg in execution_result.command) + else: + command = execution_result.command message = "Command '{command}' has failed with code {code}.\nErrors:\n{err}\n".format( - command=command, + command=command, code=execution_result.exit_code, err=_format_error(execution_result.std_err)) if cores: @@ -62,7 +62,7 @@ class ExecutionError(Exception): message += "Backtrace is not available: module cores isn't available" super(ExecutionError, self).__init__(message) - self.execution_result = execution_result + self.execution_result = execution_result class TimeoutError(Exception): @@ -274,7 +274,7 @@ class _Execution(object): afile.write(six.ensure_binary(self._backtrace)) # generate pretty html version of backtrace aka Tri Korochki pbt_filename = bt_filename + ".html" - backtrace_to_html(bt_filename, pbt_filename) + backtrace_to_html(bt_filename, pbt_filename) if store_cores: runtime._register_core(os.path.basename(self.command[0]), self.command[0], core_path, bt_filename, pbt_filename) @@ -288,11 +288,11 @@ class _Execution(object): try: if hasattr(os, "wait4"): try: - if hasattr(subprocess, "_eintr_retry_call"): - pid, sts, rusage = subprocess._eintr_retry_call(os.wait4, self._process.pid, 0) - else: - # PEP 475 - pid, sts, rusage = os.wait4(self._process.pid, 0) + if hasattr(subprocess, "_eintr_retry_call"): + pid, sts, rusage = subprocess._eintr_retry_call(os.wait4, self._process.pid, 0) + else: + # PEP 475 + pid, sts, rusage = os.wait4(self._process.pid, 0) finished = time.time() self._process._handle_exitstatus(sts) for field in [ @@ -447,7 +447,7 @@ def execute( """ if env is None: env = os.environ.copy() - else: + else: # Certain environment variables must be present for programs to work properly. # For more info see DEVTOOLSSUPPORT-4907 mandatory_env_name = 'YA_MANDATORY_ENV_VARS' @@ -458,10 +458,10 @@ def execute( else: mandatory_system_vars = ['TMPDIR'] - for var in mandatory_system_vars: - if var not in env and var in os.environ: - env[var] = os.environ[var] - + for var in mandatory_system_vars: + if var not in env and var in os.environ: + env[var] = os.environ[var] + if not wait and timeout is not None: raise ValueError("Incompatible arguments 'timeout' and wait=False") @@ -518,7 +518,7 @@ def execute( else: yatest_logger.debug("Executing '%s' in '%s'", command, cwd) # XXX - + started = time.time() process = subprocess.Popen( command, shell=shell, universal_newlines=True, @@ -703,9 +703,9 @@ def check_glibc_version(binary_path): if not match: continue assert distutils.version.LooseVersion(match.group(1)) <= lucid_glibc_version, match.group(0) - - -def backtrace_to_html(bt_filename, output): + + +def backtrace_to_html(bt_filename, output): try: from library.python import coredump_filter with open(output, "wb") as afile: diff --git a/library/python/testing/yatest_common/yatest/common/runtime.py b/library/python/testing/yatest_common/yatest/common/runtime.py index 37b848cf15..e55e193446 100644 --- a/library/python/testing/yatest_common/yatest/common/runtime.py +++ b/library/python/testing/yatest_common/yatest/common/runtime.py @@ -18,12 +18,12 @@ def _get_ya_config(): import pytest return pytest.config except (ImportError, AttributeError): - try: - import library.python.testing.recipe - if library.python.testing.recipe.ya: - return library.python.testing.recipe - except (ImportError, AttributeError): - pass + try: + import library.python.testing.recipe + if library.python.testing.recipe.ya: + return library.python.testing.recipe + except (ImportError, AttributeError): + pass raise NotImplementedError("yatest.common.* is only available from the testing runtime") @@ -160,11 +160,11 @@ def work_path(path=None): :param path: path relative to the test suite working dir :return: absolute path inside the test suite working dir """ - return _join_path( - os.environ.get("TEST_WORK_PATH") or - _get_ya_plugin_instance().get_context("work_path") or - os.getcwd(), - path) + return _join_path( + os.environ.get("TEST_WORK_PATH") or + _get_ya_plugin_instance().get_context("work_path") or + os.getcwd(), + path) def python_path(): @@ -304,10 +304,10 @@ class Context(object): return _get_ya_plugin_instance().get_context("test_stderr") @property - def test_debug(self): - return _get_ya_plugin_instance().get_context("test_debug") - - @property + def test_debug(self): + return _get_ya_plugin_instance().get_context("test_debug") + + @property def test_traceback(self): return _get_ya_plugin_instance().get_context("test_traceback") @@ -315,29 +315,29 @@ class Context(object): def test_name(self): return _get_ya_config().current_test_name - @property - def sanitize(self): + @property + def sanitize(self): """ Detect if current test run is under sanitizer :return: one of `None`, 'address', 'memory', 'thread', 'undefined' """ - return _get_ya_plugin_instance().get_context("sanitize") - - @property - def flags(self): - _flags = _get_ya_plugin_instance().get_context("flags") - if _flags: - _flags_dict = dict() - for f in _flags: - key, value = f.split('=', 1) - _flags_dict[key] = value - return _flags_dict - else: - return dict() - - def get_context_key(self, key): - return _get_ya_plugin_instance().get_context(key) - - + return _get_ya_plugin_instance().get_context("sanitize") + + @property + def flags(self): + _flags = _get_ya_plugin_instance().get_context("flags") + if _flags: + _flags_dict = dict() + for f in _flags: + key, value = f.split('=', 1) + _flags_dict[key] = value + return _flags_dict + else: + return dict() + + def get_context_key(self, key): + return _get_ya_plugin_instance().get_context(key) + + context = Context() |