diff options
author | smishin <smishin@yandex-team.ru> | 2022-02-10 16:51:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:05 +0300 |
commit | b416e76a260727c68d4301977966cfae384c2a23 (patch) | |
tree | 83bc374c2058d1ecb5e29f700fad8809984ef609 | |
parent | c97fdc253119363a87ed8e30aa28fd08bfcdde35 (diff) | |
download | ydb-b416e76a260727c68d4301977966cfae384c2a23.tar.gz |
Restoring authorship annotation for <smishin@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | build/ya.conf.json | 70 | ||||
-rw-r--r-- | library/python/testing/yatest_common/yatest/common/process.py | 60 |
2 files changed, 65 insertions, 65 deletions
diff --git a/build/ya.conf.json b/build/ya.conf.json index 5f7cc875d6..d4e7b3ba62 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -284,9 +284,9 @@ "crypta": { "description": "Run Crypta client" }, - "apphost": { - "description": "Run local apphost instance" - }, + "apphost": { + "description": "Run local apphost instance" + }, "renderer": { "description": "Run local renderer instance" }, @@ -4690,28 +4690,28 @@ } ] }, - "apphost": { - "tools": { - "apphost": { - "bottle": "apphost", - "executable": "app_host_launcher" - } - }, - "platforms": [ - { - "host": { - "os": "LINUX" - }, - "default": true - }, - { - "host": { - "os": "DARWIN" - }, - "default": true - } - ] - }, + "apphost": { + "tools": { + "apphost": { + "bottle": "apphost", + "executable": "app_host_launcher" + } + }, + "platforms": [ + { + "host": { + "os": "LINUX" + }, + "default": true + }, + { + "host": { + "os": "DARWIN" + }, + "default": true + } + ] + }, "renderer": { "tools": { "renderer": { @@ -7326,17 +7326,17 @@ ] } }, - "apphost": { - "formula": { + "apphost": { + "formula": { "sandbox_id": 1210601039, - "match": "app_host_launcher" - }, - "executable": { - "app_host_launcher": [ - "app_host_launcher" - ] - } - }, + "match": "app_host_launcher" + }, + "executable": { + "app_host_launcher": [ + "app_host_launcher" + ] + } + }, "renderer": { "formula": { "sandbox_id": [ diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index a8bcc21f51..485eb26fa0 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -231,19 +231,19 @@ class _Execution(object): for key, value in six.iteritems(self._metrics): yatest_logger.debug("Command (pid %s) %s: %s", self._process.pid, key, value) - # Since this code is Python2/3 compatible, we don't know is _std_out/_std_err is real bytes or bytes-str. - printable_std_out, err = _try_convert_bytes_to_string(self._std_out) - if err: - yatest_logger.debug("Got error during parse process stdout: %s", err) - yatest_logger.debug("stdout will be displayed as raw bytes.") - printable_std_err, err = _try_convert_bytes_to_string(self._std_err) - if err: - yatest_logger.debug("Got error during parse process stderr: %s", err) - yatest_logger.debug("stderr will be displayed as raw bytes.") - - yatest_logger.debug("Command (pid %s) output:\n%s", self._process.pid, truncate(printable_std_out, MAX_OUT_LEN)) - yatest_logger.debug("Command (pid %s) errors:\n%s", self._process.pid, truncate(printable_std_err, MAX_OUT_LEN)) - + # Since this code is Python2/3 compatible, we don't know is _std_out/_std_err is real bytes or bytes-str. + printable_std_out, err = _try_convert_bytes_to_string(self._std_out) + if err: + yatest_logger.debug("Got error during parse process stdout: %s", err) + yatest_logger.debug("stdout will be displayed as raw bytes.") + printable_std_err, err = _try_convert_bytes_to_string(self._std_err) + if err: + yatest_logger.debug("Got error during parse process stderr: %s", err) + yatest_logger.debug("stderr will be displayed as raw bytes.") + + yatest_logger.debug("Command (pid %s) output:\n%s", self._process.pid, truncate(printable_std_out, MAX_OUT_LEN)) + yatest_logger.debug("Command (pid %s) errors:\n%s", self._process.pid, truncate(printable_std_err, MAX_OUT_LEN)) + def _clean_files(self): if self._err_file and not self._user_stderr and self._err_file != subprocess.PIPE: self._err_file.close() @@ -714,20 +714,20 @@ def backtrace_to_html(bt_filename, output): yatest_logger.debug("Failed to import coredump_filter: %s", e) with open(output, "wb") as afile: afile.write("<html>Failed to import coredump_filter in USE_ARCADIA_PYTHON=no mode</html>") - - -def _try_convert_bytes_to_string(source): - """ Function is necessary while this code Python2/3 compatible, because bytes in Python3 is a real bytes and in Python2 is not """ - # Bit ugly typecheck, because in Python2 isinstance(str(), bytes) and "type(str()) is bytes" working as True as well - if 'bytes' not in str(type(source)): - # We already got not bytes. Nothing to do here. - return source, False - - result = source - error = False - try: - result = source.decode(encoding='utf-8') - except ValueError as e: - error = e - - return result, error + + +def _try_convert_bytes_to_string(source): + """ Function is necessary while this code Python2/3 compatible, because bytes in Python3 is a real bytes and in Python2 is not """ + # Bit ugly typecheck, because in Python2 isinstance(str(), bytes) and "type(str()) is bytes" working as True as well + if 'bytes' not in str(type(source)): + # We already got not bytes. Nothing to do here. + return source, False + + result = source + error = False + try: + result = source.decode(encoding='utf-8') + except ValueError as e: + error = e + + return result, error |