MCPcopy
hub / github.com/pytest-dev/pytest / test_tb_option

Method test_tb_option

testing/test_terminal.py:1562–1587  ·  view source on GitHub ↗
(self, pytester: Pytester, option)

Source from the content-addressed store, hash-verified

1560 )
1561
1562 def test_tb_option(self, pytester: Pytester, option) -> None:
1563 pytester.makepyfile(
1564 """
1565 import pytest
1566 def g():
1567 raise IndexError
1568 def test_func():
1569 print(6*7)
1570 g() # --calling--
1571 """
1572 )
1573 for tbopt in ["long", "short", "no"]:
1574 print(f"testing --tb={tbopt}...")
1575 result = pytester.runpytest("-rN", f"--tb={tbopt}")
1576 s = result.stdout.str()
1577 if tbopt == "long":
1578 assert "print(6*7)" in s
1579 else:
1580 assert "print(6*7)" not in s
1581 if tbopt != "no":
1582 assert "--calling--" in s
1583 assert "IndexError" in s
1584 else:
1585 assert "FAILURES" not in s
1586 assert "--calling--" not in s
1587 assert "IndexError" not in s
1588
1589 def test_tb_line_show_capture(self, pytester: Pytester, option) -> None:
1590 output_to_capture = "help! let me out!"

Callers

nothing calls this directly

Calls 3

strMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected