MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_tb_option

Method test_tb_option

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

Source from the content-addressed store, hash-verified

1403 )
1404
1405 def test_tb_option(self, pytester: Pytester, option) -> None:
1406 pytester.makepyfile(
1407 """
1408 import pytest
1409 def g():
1410 raise IndexError
1411 def test_func():
1412 print(6*7)
1413 g() # --calling--
1414 """
1415 )
1416 for tbopt in ["long", "short", "no"]:
1417 print("testing --tb=%s..." % tbopt)
1418 result = pytester.runpytest("-rN", "--tb=%s" % tbopt)
1419 s = result.stdout.str()
1420 if tbopt == "long":
1421 assert "print(6*7)" in s
1422 else:
1423 assert "print(6*7)" not in s
1424 if tbopt != "no":
1425 assert "--calling--" in s
1426 assert "IndexError" in s
1427 else:
1428 assert "FAILURES" not in s
1429 assert "--calling--" not in s
1430 assert "IndexError" not in s
1431
1432 def test_tb_crashline(self, pytester: Pytester, option) -> None:
1433 p = pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

strMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected