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

Method test_tb_crashline

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

Source from the content-addressed store, hash-verified

1600 result.stdout.fnmatch_lines(["*- Captured stdout call -*", output_to_capture])
1601
1602 def test_tb_crashline(self, pytester: Pytester, option) -> None:
1603 p = pytester.makepyfile(
1604 """
1605 import pytest
1606 def g():
1607 raise IndexError
1608 def test_func1():
1609 print(6*7)
1610 g() # --calling--
1611 def test_func2():
1612 assert 0, "hello"
1613 """
1614 )
1615 result = pytester.runpytest("--tb=line")
1616 bn = p.name
1617 result.stdout.fnmatch_lines(
1618 [f"*{bn}:3: IndexError*", f"*{bn}:8: AssertionError: hello*"]
1619 )
1620 s = result.stdout.str()
1621 assert "def test_func2" not in s
1622
1623 def test_tb_crashline_pytrace_false(self, pytester: Pytester, option) -> None:
1624 p = pytester.makepyfile(

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