aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/pytest/ut/test_tools.py
diff options
context:
space:
mode:
authorprettyboy <prettyboy@yandex-team.com>2023-01-20 16:33:46 +0300
committerprettyboy <prettyboy@yandex-team.com>2023-01-20 16:33:46 +0300
commitc6a952a6e1eda08c6e1742ec1170691cec3670da (patch)
treeb28ddb53b5ce194482167c04cadc532353b1193d /library/python/pytest/ut/test_tools.py
parent5c6ff1d7c6908ac41bcd7b4711c1396809d4b0a8 (diff)
downloadydb-c6a952a6e1eda08c6e1742ec1170691cec3670da.tar.gz
[library/python/pytest] Better py3 colorization
Diffstat (limited to 'library/python/pytest/ut/test_tools.py')
-rw-r--r--library/python/pytest/ut/test_tools.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/library/python/pytest/ut/test_tools.py b/library/python/pytest/ut/test_tools.py
index 412ec42d24..212a20fb17 100644
--- a/library/python/pytest/ut/test_tools.py
+++ b/library/python/pytest/ut/test_tools.py
@@ -95,3 +95,39 @@ def test_path_resolving_for_local_conftest_load_policy(
mocker.patch.object(sys, 'extra_modules', extra_modules)
got = yatest_tools.split_node_id(node_id + parameters)
assert (expected_class_name, expected_test_name + parameters) == got
+
+
+DATA = [
+ (
+ "simple_bt",
+ """
+path/test.py:15: in test
+ return foo(0)
+path/test.py:5: in foo
+ b, a = 1, 1 / p
+E ZeroDivisionError: integer division or modulo by zero
+""",
+ ),
+ (
+ "nested_by",
+ """
+path/test.py:13: in test
+ raise Exception("123\n123\npath/test.py:15: in test")
+E Exception: 123
+E 123
+E path/test.py:15: in test
+
+During handling of the above exception, another exception occurred:
+path/test.py:15: in test
+ return foo(0)
+path/test.py:5: in foo
+ b, a = 1, 1 / p
+E ZeroDivisionError: division by zero
+""",
+ ),
+]
+
+
+@pytest.mark.parametrize("bt", [x[1] for x in DATA], ids=([x[0] for x in DATA]))
+def test_colorize_pytest_error(bt):
+ return yatest_tools.colorize_pytest_error(bt)