(self, pytester: Pytester, option)
| 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!" |
nothing calls this directly
no test coverage detected