diff options
author | abodrov <abodrov@yandex-team.ru> | 2022-02-10 16:47:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:18 +0300 |
commit | 1b8c043abfc689b3d27384c4202b20031fc4ae31 (patch) | |
tree | 43ffe3a7cfe51a083e22d9eabb71c4f5321f6b08 /library | |
parent | e7a025f6f4917a3eb54227db101e58bb26ee2cfa (diff) | |
download | ydb-1b8c043abfc689b3d27384c4202b20031fc4ae31.tar.gz |
Restoring authorship annotation for <abodrov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
26 files changed, 357 insertions, 357 deletions
diff --git a/library/python/runtime_py3/importer.pxi b/library/python/runtime_py3/importer.pxi index 904f94dea2..56aa0b08df 100644 --- a/library/python/runtime_py3/importer.pxi +++ b/library/python/runtime_py3/importer.pxi @@ -254,11 +254,11 @@ class ResourceImporter(object): # Used by `linecache` (while printing tracebacks) unless module filename # exists on the filesystem. def get_source(self, fullname): - fullname = self._source_name.get(fullname) or fullname - if self.is_package(fullname): - fullname += '.__init__' - - relpath = self.get_filename(fullname) + fullname = self._source_name.get(fullname) or fullname + if self.is_package(fullname): + fullname += '.__init__' + + relpath = self.get_filename(fullname) if relpath: abspath = resfs_resolve(relpath) if abspath: diff --git a/library/python/runtime_py3/test/canondata/result.json b/library/python/runtime_py3/test/canondata/result.json index a7d045fc9c..3d07930460 100644 --- a/library/python/runtime_py3/test/canondata/result.json +++ b/library/python/runtime_py3/test/canondata/result.json @@ -1,62 +1,62 @@ -{ - "test_traceback.test_traceback[custom-default]": { - "stderr": { +{ + "test_traceback.test_traceback[custom-default]": { + "stderr": { "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", - "uri": "file://test_traceback.test_traceback_custom-default_/stderr.txt" - }, - "stdout": { - "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", - "uri": "file://test_traceback.test_traceback_custom-default_/stdout.txt" - } - }, - "test_traceback.test_traceback[custom-ultratb_color]": { - "stderr": { - "checksum": "048e27049fb8db64bd295b17f505b0ad", - "uri": "file://test_traceback.test_traceback_custom-ultratb_color_/stderr.txt" - }, - "stdout": { - "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", - "uri": "file://test_traceback.test_traceback_custom-ultratb_color_/stdout.txt" - } - }, - "test_traceback.test_traceback[custom-ultratb_verbose]": { - "stderr": { - "checksum": "e9af42aa3736141d9b67a1652eea412e", - "uri": "file://test_traceback.test_traceback_custom-ultratb_verbose_/stderr.txt" - }, - "stdout": { - "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", - "uri": "file://test_traceback.test_traceback_custom-ultratb_verbose_/stdout.txt" - } - }, - "test_traceback.test_traceback[main-default]": { - "stderr": { + "uri": "file://test_traceback.test_traceback_custom-default_/stderr.txt" + }, + "stdout": { + "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", + "uri": "file://test_traceback.test_traceback_custom-default_/stdout.txt" + } + }, + "test_traceback.test_traceback[custom-ultratb_color]": { + "stderr": { + "checksum": "048e27049fb8db64bd295b17f505b0ad", + "uri": "file://test_traceback.test_traceback_custom-ultratb_color_/stderr.txt" + }, + "stdout": { + "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", + "uri": "file://test_traceback.test_traceback_custom-ultratb_color_/stdout.txt" + } + }, + "test_traceback.test_traceback[custom-ultratb_verbose]": { + "stderr": { + "checksum": "e9af42aa3736141d9b67a1652eea412e", + "uri": "file://test_traceback.test_traceback_custom-ultratb_verbose_/stderr.txt" + }, + "stdout": { + "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", + "uri": "file://test_traceback.test_traceback_custom-ultratb_verbose_/stdout.txt" + } + }, + "test_traceback.test_traceback[main-default]": { + "stderr": { "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", - "uri": "file://test_traceback.test_traceback_main-default_/stderr.txt" - }, - "stdout": { - "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", - "uri": "file://test_traceback.test_traceback_main-default_/stdout.txt" - } - }, - "test_traceback.test_traceback[main-ultratb_color]": { - "stderr": { - "checksum": "048e27049fb8db64bd295b17f505b0ad", - "uri": "file://test_traceback.test_traceback_main-ultratb_color_/stderr.txt" - }, - "stdout": { - "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", - "uri": "file://test_traceback.test_traceback_main-ultratb_color_/stdout.txt" - } - }, - "test_traceback.test_traceback[main-ultratb_verbose]": { - "stderr": { - "checksum": "e9af42aa3736141d9b67a1652eea412e", - "uri": "file://test_traceback.test_traceback_main-ultratb_verbose_/stderr.txt" - }, - "stdout": { - "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", - "uri": "file://test_traceback.test_traceback_main-ultratb_verbose_/stdout.txt" - } - } -}
\ No newline at end of file + "uri": "file://test_traceback.test_traceback_main-default_/stderr.txt" + }, + "stdout": { + "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", + "uri": "file://test_traceback.test_traceback_main-default_/stdout.txt" + } + }, + "test_traceback.test_traceback[main-ultratb_color]": { + "stderr": { + "checksum": "048e27049fb8db64bd295b17f505b0ad", + "uri": "file://test_traceback.test_traceback_main-ultratb_color_/stderr.txt" + }, + "stdout": { + "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", + "uri": "file://test_traceback.test_traceback_main-ultratb_color_/stdout.txt" + } + }, + "test_traceback.test_traceback[main-ultratb_verbose]": { + "stderr": { + "checksum": "e9af42aa3736141d9b67a1652eea412e", + "uri": "file://test_traceback.test_traceback_main-ultratb_verbose_/stderr.txt" + }, + "stdout": { + "checksum": "e120a1e0b7fdddc8e6b4d4b506403e89", + "uri": "file://test_traceback.test_traceback_main-ultratb_verbose_/stdout.txt" + } + } +}
\ No newline at end of file diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt index 5eb7da170a..3c955aebe5 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt @@ -1,12 +1,12 @@ -Traceback (most recent call last): - File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main +Traceback (most recent call last): + File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main one() - File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one + File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one modfunc(two) # aaa - File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc + File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc f() # call back to caller - File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two + File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two three(42) - File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three + File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) -RuntimeError: Kaboom! I'm dead: 42 +RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stdout.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stdout.txt index 2c9793eb14..cf67cf5eef 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stdout.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stdout.txt @@ -1,2 +1,2 @@ -__name__ = library.python.runtime_py3.test.traceback.crash -__file__ = library/python/runtime_py3/test/traceback/crash.py +__name__ = library.python.runtime_py3.test.traceback.crash +__file__ = library/python/runtime_py3/test/traceback/crash.py diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stderr.txt index 9e5a474cbd..03d0c8273a 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stderr.txt @@ -1,13 +1,13 @@ -Traceback (most recent call last): - File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main - one() - File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one - modfunc(two) # aaa - File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc - f() # call back to caller - File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two - three(42) - File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three - raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) -RuntimeError: Kaboom! I'm dead: 42 - +Traceback (most recent call last): + File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main + one() + File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one + modfunc(two) # aaa + File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc + f() # call back to caller + File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two + three(42) + File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three + raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) +RuntimeError: Kaboom! I'm dead: 42 + diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stdout.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stdout.txt index 2c9793eb14..cf67cf5eef 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stdout.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_color_/stdout.txt @@ -1,2 +1,2 @@ -__name__ = library.python.runtime_py3.test.traceback.crash -__file__ = library/python/runtime_py3/test/traceback/crash.py +__name__ = library.python.runtime_py3.test.traceback.crash +__file__ = library/python/runtime_py3/test/traceback/crash.py diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stderr.txt index b0b299ebe6..b7ba1a2df2 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stderr.txt @@ -1,41 +1,41 @@ ---------------------------------------------------------------------------- -RuntimeError Traceback (most recent call last) -library/python/runtime_py3/test/traceback/crash.py in main() - 42 sys.executable = '<traceback test>' - 43 ----> 44 one() - global one = <function one> - -library/python/runtime_py3/test/traceback/crash.py in one() - 10 - 11 def one(): ----> 12 modfunc(two) # aaa - global modfunc = <function modfunc> - global two = <function two> - 13 - 14 - -library/python/runtime_py3/test/traceback/mod/__init__.py in modfunc(f=<function two>) - 1 def modfunc(f): - 2 # lalala -----> 3 f() # call back to caller - f = <function two> - -library/python/runtime_py3/test/traceback/crash.py in two() - 14 - 15 def two(): ----> 16 three(42) - global three = <function three> - 17 - 18 - -library/python/runtime_py3/test/traceback/crash.py in three(x=42) - 18 - 19 def three(x): ----> 20 raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) - global RuntimeError.format = undefined - x = 42 - 21 - 22 - -RuntimeError: Kaboom! I'm dead: 42 +--------------------------------------------------------------------------- +RuntimeError Traceback (most recent call last) +library/python/runtime_py3/test/traceback/crash.py in main() + 42 sys.executable = '<traceback test>' + 43 +---> 44 one() + global one = <function one> + +library/python/runtime_py3/test/traceback/crash.py in one() + 10 + 11 def one(): +---> 12 modfunc(two) # aaa + global modfunc = <function modfunc> + global two = <function two> + 13 + 14 + +library/python/runtime_py3/test/traceback/mod/__init__.py in modfunc(f=<function two>) + 1 def modfunc(f): + 2 # lalala +----> 3 f() # call back to caller + f = <function two> + +library/python/runtime_py3/test/traceback/crash.py in two() + 14 + 15 def two(): +---> 16 three(42) + global three = <function three> + 17 + 18 + +library/python/runtime_py3/test/traceback/crash.py in three(x=42) + 18 + 19 def three(x): +---> 20 raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) + global RuntimeError.format = undefined + x = 42 + 21 + 22 + +RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stdout.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stdout.txt index 2c9793eb14..cf67cf5eef 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stdout.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-ultratb_verbose_/stdout.txt @@ -1,2 +1,2 @@ -__name__ = library.python.runtime_py3.test.traceback.crash -__file__ = library/python/runtime_py3/test/traceback/crash.py +__name__ = library.python.runtime_py3.test.traceback.crash +__file__ = library/python/runtime_py3/test/traceback/crash.py diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt index 5eb7da170a..3c955aebe5 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt @@ -1,12 +1,12 @@ -Traceback (most recent call last): - File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main +Traceback (most recent call last): + File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main one() - File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one + File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one modfunc(two) # aaa - File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc + File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc f() # call back to caller - File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two + File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two three(42) - File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three + File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) -RuntimeError: Kaboom! I'm dead: 42 +RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stdout.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stdout.txt index 2c9793eb14..cf67cf5eef 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stdout.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stdout.txt @@ -1,2 +1,2 @@ -__name__ = library.python.runtime_py3.test.traceback.crash -__file__ = library/python/runtime_py3/test/traceback/crash.py +__name__ = library.python.runtime_py3.test.traceback.crash +__file__ = library/python/runtime_py3/test/traceback/crash.py diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stderr.txt index 9e5a474cbd..03d0c8273a 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stderr.txt @@ -1,13 +1,13 @@ -Traceback (most recent call last): - File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main - one() - File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one - modfunc(two) # aaa - File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc - f() # call back to caller - File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two - three(42) - File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three - raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) -RuntimeError: Kaboom! I'm dead: 42 - +Traceback (most recent call last): + File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main + one() + File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one + modfunc(two) # aaa + File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc + f() # call back to caller + File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two + three(42) + File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three + raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) +RuntimeError: Kaboom! I'm dead: 42 + diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stdout.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stdout.txt index 2c9793eb14..cf67cf5eef 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stdout.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_color_/stdout.txt @@ -1,2 +1,2 @@ -__name__ = library.python.runtime_py3.test.traceback.crash -__file__ = library/python/runtime_py3/test/traceback/crash.py +__name__ = library.python.runtime_py3.test.traceback.crash +__file__ = library/python/runtime_py3/test/traceback/crash.py diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stderr.txt index b0b299ebe6..b7ba1a2df2 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stderr.txt @@ -1,41 +1,41 @@ ---------------------------------------------------------------------------- -RuntimeError Traceback (most recent call last) -library/python/runtime_py3/test/traceback/crash.py in main() - 42 sys.executable = '<traceback test>' - 43 ----> 44 one() - global one = <function one> - -library/python/runtime_py3/test/traceback/crash.py in one() - 10 - 11 def one(): ----> 12 modfunc(two) # aaa - global modfunc = <function modfunc> - global two = <function two> - 13 - 14 - -library/python/runtime_py3/test/traceback/mod/__init__.py in modfunc(f=<function two>) - 1 def modfunc(f): - 2 # lalala -----> 3 f() # call back to caller - f = <function two> - -library/python/runtime_py3/test/traceback/crash.py in two() - 14 - 15 def two(): ----> 16 three(42) - global three = <function three> - 17 - 18 - -library/python/runtime_py3/test/traceback/crash.py in three(x=42) - 18 - 19 def three(x): ----> 20 raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) - global RuntimeError.format = undefined - x = 42 - 21 - 22 - -RuntimeError: Kaboom! I'm dead: 42 +--------------------------------------------------------------------------- +RuntimeError Traceback (most recent call last) +library/python/runtime_py3/test/traceback/crash.py in main() + 42 sys.executable = '<traceback test>' + 43 +---> 44 one() + global one = <function one> + +library/python/runtime_py3/test/traceback/crash.py in one() + 10 + 11 def one(): +---> 12 modfunc(two) # aaa + global modfunc = <function modfunc> + global two = <function two> + 13 + 14 + +library/python/runtime_py3/test/traceback/mod/__init__.py in modfunc(f=<function two>) + 1 def modfunc(f): + 2 # lalala +----> 3 f() # call back to caller + f = <function two> + +library/python/runtime_py3/test/traceback/crash.py in two() + 14 + 15 def two(): +---> 16 three(42) + global three = <function three> + 17 + 18 + +library/python/runtime_py3/test/traceback/crash.py in three(x=42) + 18 + 19 def three(x): +---> 20 raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) + global RuntimeError.format = undefined + x = 42 + 21 + 22 + +RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stdout.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stdout.txt index 2c9793eb14..cf67cf5eef 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stdout.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-ultratb_verbose_/stdout.txt @@ -1,2 +1,2 @@ -__name__ = library.python.runtime_py3.test.traceback.crash -__file__ = library/python/runtime_py3/test/traceback/crash.py +__name__ = library.python.runtime_py3.test.traceback.crash +__file__ = library/python/runtime_py3/test/traceback/crash.py diff --git a/library/python/runtime_py3/test/test_traceback.py b/library/python/runtime_py3/test/test_traceback.py index 82087ce98a..0cc4dec75a 100644 --- a/library/python/runtime_py3/test/test_traceback.py +++ b/library/python/runtime_py3/test/test_traceback.py @@ -1,63 +1,63 @@ -# -*- coding: utf-8 -*- - -from __future__ import print_function, absolute_import, division - -import os -import re - -import pytest - -import yatest.common as yc - - -def clean_traceback(traceback): - traceback = re.sub(br'\033\[(\d|;)+?m', b'', traceback) # strip ANSI codes - traceback = re.sub(br' at 0x[0-9a-fA-F]+', b'', traceback) # remove object ids - return traceback - - -@pytest.mark.parametrize('mode', [ - 'default', - 'ultratb_color', - 'ultratb_verbose', -]) -@pytest.mark.parametrize('entry_point', [ - 'main', - 'custom', -]) -def test_traceback(mode, entry_point): - tb_tool = yc.build_path('library/python/runtime_py3/test/traceback/traceback') - stdout_path = yc.test_output_path('stdout_raw.txt') - stderr_path = yc.test_output_path('stderr_raw.txt') - filtered_stdout_path = yc.test_output_path('stdout.txt') - filtered_stderr_path = yc.test_output_path('stderr.txt') - - env = os.environ.copy() +# -*- coding: utf-8 -*- + +from __future__ import print_function, absolute_import, division + +import os +import re + +import pytest + +import yatest.common as yc + + +def clean_traceback(traceback): + traceback = re.sub(br'\033\[(\d|;)+?m', b'', traceback) # strip ANSI codes + traceback = re.sub(br' at 0x[0-9a-fA-F]+', b'', traceback) # remove object ids + return traceback + + +@pytest.mark.parametrize('mode', [ + 'default', + 'ultratb_color', + 'ultratb_verbose', +]) +@pytest.mark.parametrize('entry_point', [ + 'main', + 'custom', +]) +def test_traceback(mode, entry_point): + tb_tool = yc.build_path('library/python/runtime_py3/test/traceback/traceback') + stdout_path = yc.test_output_path('stdout_raw.txt') + stderr_path = yc.test_output_path('stderr_raw.txt') + filtered_stdout_path = yc.test_output_path('stdout.txt') + filtered_stderr_path = yc.test_output_path('stderr.txt') + + env = os.environ.copy() env.pop('PYTHONPATH', None) # Do not let program peek into its sources on filesystem - if entry_point == 'custom': - env['Y_PYTHON_ENTRY_POINT'] = 'library.python.runtime_py3.test.traceback.crash:main' - - proc = yc.execute( - command=[tb_tool, mode], - env=env, - stdout=stdout_path, - stderr=stderr_path, - check_exit_code=False, - ) - - with open(filtered_stdout_path, 'wb') as f: - f.write(clean_traceback(proc.std_out)) - - with open(filtered_stderr_path, 'wb') as f: - f.write(clean_traceback(proc.std_err)) - - return { - 'stdout': yc.canonical_file( - filtered_stdout_path, - local=True, - ), - 'stderr': yc.canonical_file( - filtered_stderr_path, - local=True, - ), - } + if entry_point == 'custom': + env['Y_PYTHON_ENTRY_POINT'] = 'library.python.runtime_py3.test.traceback.crash:main' + + proc = yc.execute( + command=[tb_tool, mode], + env=env, + stdout=stdout_path, + stderr=stderr_path, + check_exit_code=False, + ) + + with open(filtered_stdout_path, 'wb') as f: + f.write(clean_traceback(proc.std_out)) + + with open(filtered_stderr_path, 'wb') as f: + f.write(clean_traceback(proc.std_err)) + + return { + 'stdout': yc.canonical_file( + filtered_stdout_path, + local=True, + ), + 'stderr': yc.canonical_file( + filtered_stderr_path, + local=True, + ), + } diff --git a/library/python/runtime_py3/test/traceback/__main__.py b/library/python/runtime_py3/test/traceback/__main__.py index 364db169f0..b9dadae488 100644 --- a/library/python/runtime_py3/test/traceback/__main__.py +++ b/library/python/runtime_py3/test/traceback/__main__.py @@ -1,4 +1,4 @@ -from library.python.runtime_py3.test.traceback.crash import main - -if __name__ == "__main__": - main() +from library.python.runtime_py3.test.traceback.crash import main + +if __name__ == "__main__": + main() diff --git a/library/python/runtime_py3/test/traceback/crash.py b/library/python/runtime_py3/test/traceback/crash.py index b5e36b3dd4..854d013bdf 100644 --- a/library/python/runtime_py3/test/traceback/crash.py +++ b/library/python/runtime_py3/test/traceback/crash.py @@ -1,44 +1,44 @@ -import argparse -import cgitb -import sys -import time - -from IPython.core import ultratb - -from .mod import modfunc - - -def one(): - modfunc(two) # aaa - - -def two(): - three(42) - - -def three(x): - raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) - - -def main(): - hooks = { - 'default': lambda: sys.excepthook, - 'cgitb': lambda: cgitb.Hook(format='text'), - 'ultratb_color': lambda: ultratb.ColorTB(ostream=sys.stderr), - 'ultratb_verbose': lambda: ultratb.VerboseTB(ostream=sys.stderr), - } - - parser = argparse.ArgumentParser() - parser.add_argument('hook', choices=sorted(hooks), default='default') - - args = parser.parse_args() - - sys.excepthook = hooks[args.hook]() - - print('__name__ =', __name__) - print('__file__ =', __file__) - - time.time = lambda: 1531996624.0 # Freeze time - sys.executable = '<traceback test>' - - one() +import argparse +import cgitb +import sys +import time + +from IPython.core import ultratb + +from .mod import modfunc + + +def one(): + modfunc(two) # aaa + + +def two(): + three(42) + + +def three(x): + raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) + + +def main(): + hooks = { + 'default': lambda: sys.excepthook, + 'cgitb': lambda: cgitb.Hook(format='text'), + 'ultratb_color': lambda: ultratb.ColorTB(ostream=sys.stderr), + 'ultratb_verbose': lambda: ultratb.VerboseTB(ostream=sys.stderr), + } + + parser = argparse.ArgumentParser() + parser.add_argument('hook', choices=sorted(hooks), default='default') + + args = parser.parse_args() + + sys.excepthook = hooks[args.hook]() + + print('__name__ =', __name__) + print('__file__ =', __file__) + + time.time = lambda: 1531996624.0 # Freeze time + sys.executable = '<traceback test>' + + one() diff --git a/library/python/runtime_py3/test/traceback/mod/__init__.py b/library/python/runtime_py3/test/traceback/mod/__init__.py index f00843d786..304ec1a8f0 100644 --- a/library/python/runtime_py3/test/traceback/mod/__init__.py +++ b/library/python/runtime_py3/test/traceback/mod/__init__.py @@ -1,3 +1,3 @@ -def modfunc(f): - # lalala - f() # call back to caller +def modfunc(f): + # lalala + f() # call back to caller diff --git a/library/python/runtime_py3/test/traceback/ya.make b/library/python/runtime_py3/test/traceback/ya.make index b61fe9550b..0dddd138f9 100644 --- a/library/python/runtime_py3/test/traceback/ya.make +++ b/library/python/runtime_py3/test/traceback/ya.make @@ -1,19 +1,19 @@ -PY3_PROGRAM() - +PY3_PROGRAM() + OWNER( abodrov borman ) - -PEERDIR( - contrib/python/ipython -) - -PY_SRCS( + +PEERDIR( + contrib/python/ipython +) + +PY_SRCS( MAIN __main__.py=main - crash.py - mod/__init__.py -) - -END() + crash.py + mod/__init__.py +) + +END() diff --git a/library/python/runtime_py3/test/ya.make b/library/python/runtime_py3/test/ya.make index 4ec3db74f5..e7f5603762 100644 --- a/library/python/runtime_py3/test/ya.make +++ b/library/python/runtime_py3/test/ya.make @@ -1,12 +1,12 @@ -PY3TEST() - +PY3TEST() + OWNER( abodrov borman -) - +) + DEPENDS(library/python/runtime_py3/test/traceback) - + PEERDIR( contrib/python/parameterized contrib/python/PyYAML @@ -35,6 +35,6 @@ RESOURCE_FILES( resources/submodule/bar.txt ) -END() +END() RECURSE_FOR_TESTS(traceback) diff --git a/library/python/runtime_py3/ya.make b/library/python/runtime_py3/ya.make index fa5c11341a..6f37a6aade 100644 --- a/library/python/runtime_py3/ya.make +++ b/library/python/runtime_py3/ya.make @@ -43,7 +43,7 @@ ELSE() ENDIF() END() - -RECURSE_FOR_TESTS( - test -) + +RECURSE_FOR_TESTS( + test +) diff --git a/library/python/testing/yatest_common/yatest/common/canonical.py b/library/python/testing/yatest_common/yatest/common/canonical.py index b6a136d3e9..4943ae1a87 100644 --- a/library/python/testing/yatest_common/yatest/common/canonical.py +++ b/library/python/testing/yatest_common/yatest/common/canonical.py @@ -3,8 +3,8 @@ import logging import shutil import tempfile -import six - +import six + from . import process from . import runtime from . import path @@ -15,7 +15,7 @@ yatest_logger = logging.getLogger("ya.test") def _copy(src, dst, universal_lines=False): if universal_lines: with open(dst, "wb") as f: - for line in open(src, "rbU"): + for line in open(src, "rbU"): f.write(line) return shutil.copy(src, dst) @@ -146,7 +146,7 @@ def canonical_py_execute( def _prepare_args(args): if args is None: args = [] - if isinstance(args, six.string_types): + if isinstance(args, six.string_types): args = map(lambda a: a.strip(), args.split()) return args @@ -165,12 +165,12 @@ def _canonical_execute(excutor, kwargs, file_name, save_locally, diff_tool, diff except OSError: pass - with open(out_file_path, "wb") as out_file: + with open(out_file_path, "wb") as out_file: yatest_logger.debug("Will store file in %s", out_file_path) out_file.write(res.std_out) if res.std_err: - with open(err_file_path, "wb") as err_file: + with open(err_file_path, "wb") as err_file: err_file.write(res.std_err) return canonical_file(out_file_path, local=save_locally, diff_tool=diff_tool, diff_file_name=diff_file_name, diff_tool_timeout=diff_tool_timeout) diff --git a/library/python/testing/yatest_common/yatest/common/network.py b/library/python/testing/yatest_common/yatest/common/network.py index 37bcb1b8e0..3ef1e68915 100644 --- a/library/python/testing/yatest_common/yatest/common/network.py +++ b/library/python/testing/yatest_common/yatest/common/network.py @@ -8,8 +8,8 @@ import logging import platform import threading -import six - +import six + UI16MAXVAL = (1 << 16) - 1 logger = logging.getLogger(__name__) @@ -144,7 +144,7 @@ class PortManager(object): raise PortManagerException("All valid ports are taken ({}): {}".format(self._valid_range, self._filelocks)) salt = random.randint(0, UI16MAXVAL) - for attempt in six.moves.range(self._valid_port_count): + for attempt in six.moves.range(self._valid_port_count): probe_port = (salt + attempt) % self._valid_port_count for left, right in self._valid_range: diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index a8bcc21f51..d4084c5c64 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -11,8 +11,8 @@ import subprocess import errno import distutils.version -import six - +import six + try: # yatest.common should try to be hermetic, otherwise, PYTEST_SCRIPT (aka USE_ARCADIA_PYTHON=no) won't work. import library.python.cores as cores @@ -37,17 +37,17 @@ def truncate(s, size): elif len(s) <= size: return s else: - return (b'...' if isinstance(s, bytes) else '...') + s[-(size - 3):] + return (b'...' if isinstance(s, bytes) else '...') + s[-(size - 3):] def get_command_name(command): - return os.path.basename(command.split()[0] if isinstance(command, six.string_types) else command[0]) + return os.path.basename(command.split()[0] if isinstance(command, six.string_types) else command[0]) class ExecutionError(Exception): def __init__(self, execution_result): - if not isinstance(execution_result.command, six.string_types): + if not isinstance(execution_result.command, six.string_types): command = " ".join(str(arg) for arg in execution_result.command) else: command = execution_result.command @@ -228,7 +228,7 @@ class _Execution(object): yatest_logger.debug("Command (pid %s) rc: %s", self._process.pid, self.exit_code) yatest_logger.debug("Command (pid %s) elapsed time (sec): %s", self._process.pid, self.elapsed) if self._metrics: - for key, value in six.iteritems(self._metrics): + 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. @@ -270,7 +270,7 @@ class _Execution(object): if os.path.exists(runtime.gdb_path()): self._backtrace = cores.get_gdb_full_backtrace(self.command[0], core_path, runtime.gdb_path()) bt_filename = path.get_unique_file_path(runtime.output_path(), "{}.{}.backtrace".format(os.path.basename(self.command[0]), self._process.pid)) - with open(bt_filename, "wb") as afile: + with open(bt_filename, "wb") as afile: afile.write(six.ensure_binary(self._backtrace)) # generate pretty html version of backtrace aka Tri Korochki pbt_filename = bt_filename + ".html" @@ -473,7 +473,7 @@ def execute( # No stream is supplied: open new temp file return _get_command_output_file(command, default_name), False - if isinstance(stream, six.string_types): + if isinstance(stream, six.string_types): # User filename is supplied: open file for writing return open(stream, 'wb+'), stream.startswith('/dev/') @@ -586,7 +586,7 @@ def py_execute( :param process_progress_listener=object that is polled while execution is in progress :return _Execution: Execution object """ - if isinstance(command, six.string_types): + if isinstance(command, six.string_types): command = [command] command = [runtime.python_path()] + command if shell: diff --git a/library/python/testing/yatest_common/yatest/common/runtime.py b/library/python/testing/yatest_common/yatest/common/runtime.py index e55e193446..b96f17a53d 100644 --- a/library/python/testing/yatest_common/yatest/common/runtime.py +++ b/library/python/testing/yatest_common/yatest/common/runtime.py @@ -4,9 +4,9 @@ import json import os import threading -import six - +import six + _lock = threading.Lock() @@ -34,7 +34,7 @@ def _get_ya_plugin_instance(): def _norm_path(path): if path is None: return None - assert isinstance(path, six.string_types) + assert isinstance(path, six.string_types) if "\\" in path: raise AssertionError("path {} contains Windows seprators \\ - replace them with '/'".format(path)) return os.path.normpath(path) diff --git a/library/python/ya.make b/library/python/ya.make index 2e1eb6e0e1..4314262ef2 100644 --- a/library/python/ya.make +++ b/library/python/ya.make @@ -161,7 +161,7 @@ RECURSE( runtime/test runtime_py3 runtime_py3/main - runtime_py3/test + runtime_py3/test runtime_test sanitizers sdms_api |