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 | f02a874a7290593efbe4b3aeae69a04b46c1cc86 (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/python/runtime_py3 | |
parent | 1b8c043abfc689b3d27384c4202b20031fc4ae31 (diff) | |
download | ydb-f02a874a7290593efbe4b3aeae69a04b46c1cc86.tar.gz |
Restoring authorship annotation for <abodrov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/runtime_py3')
21 files changed, 335 insertions, 335 deletions
diff --git a/library/python/runtime_py3/importer.pxi b/library/python/runtime_py3/importer.pxi index 56aa0b08df..904f94dea2 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 3d07930460..a7d045fc9c 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 3c955aebe5..5eb7da170a 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 cf67cf5eef..2c9793eb14 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 03d0c8273a..9e5a474cbd 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 cf67cf5eef..2c9793eb14 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 b7ba1a2df2..b0b299ebe6 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 cf67cf5eef..2c9793eb14 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 3c955aebe5..5eb7da170a 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 cf67cf5eef..2c9793eb14 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 03d0c8273a..9e5a474cbd 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 cf67cf5eef..2c9793eb14 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 b7ba1a2df2..b0b299ebe6 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 cf67cf5eef..2c9793eb14 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 0cc4dec75a..82087ce98a 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 b9dadae488..364db169f0 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 854d013bdf..b5e36b3dd4 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 304ec1a8f0..f00843d786 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 0dddd138f9..b61fe9550b 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 e7f5603762..4ec3db74f5 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 6f37a6aade..fa5c11341a 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 +) |