File: test_result.py

package info (click to toggle)
python-pluggy 1.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 476 kB
  • sloc: python: 3,344; sh: 58; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 597 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import traceback

from pluggy import Result


def test_exceptions_traceback_doesnt_get_longer_and_longer() -> None:
    def bad() -> None:
        1 / 0

    result = Result.from_call(bad)

    try:
        result.get_result()
    except Exception as exc:
        tb1 = traceback.extract_tb(exc.__traceback__)

    try:
        result.get_result()
    except Exception as exc:
        tb2 = traceback.extract_tb(exc.__traceback__)

    try:
        result.get_result()
    except Exception as exc:
        tb3 = traceback.extract_tb(exc.__traceback__)

    assert len(tb1) == len(tb2) == len(tb3)