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

Method test_tb_crashline

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

Source from the content-addressed store, hash-verified

1430 assert "IndexError" not in s
1431
1432 def test_tb_crashline(self, pytester: Pytester, option) -> None:
1433 p = pytester.makepyfile(
1434 """
1435 import pytest
1436 def g():
1437 raise IndexError
1438 def test_func1():
1439 print(6*7)
1440 g() # --calling--
1441 def test_func2():
1442 assert 0, "hello"
1443 """
1444 )
1445 result = pytester.runpytest("--tb=line")
1446 bn = p.name
1447 result.stdout.fnmatch_lines(
1448 ["*%s:3: IndexError*" % bn, "*%s:8: AssertionError: hello*" % bn]
1449 )
1450 s = result.stdout.str()
1451 assert "def test_func2" not in s
1452
1453 def test_pytest_report_header(self, pytester: Pytester, option) -> None:
1454 pytester.makeconftest(

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
strMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected