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

Function test_pdb_can_be_rewritten

testing/acceptance_test.py:1390–1422  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

1388
1389
1390def test_pdb_can_be_rewritten(pytester: Pytester) -> None:
1391 pytester.makepyfile(
1392 **{
1393 "conftest.py": """
1394 import pytest
1395 pytest.register_assert_rewrite("pdb")
1396 """,
1397 "__init__.py": "",
1398 "pdb.py": """
1399 def check():
1400 assert 1 == 2
1401 """,
1402 "test_pdb.py": """
1403 def test():
1404 import pdb
1405 assert pdb.check()
1406 """,
1407 }
1408 )
1409 # Disable debugging plugin itself to avoid:
1410 # > INTERNALERROR> AttributeError: module 'pdb' has no attribute 'set_trace'
1411 result = pytester.runpytest_subprocess("-p", "no:debugging", "-vv")
1412 result.stdout.fnmatch_lines(
1413 [
1414 " def check():",
1415 "> assert 1 == 2",
1416 "E assert 1 == 2",
1417 "",
1418 "pdb.py:2: AssertionError",
1419 "*= 1 failed in *",
1420 ]
1421 )
1422 assert result.ret == 1
1423
1424
1425def test_tee_stdio_captures_and_live_prints(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytest_subprocessMethod · 0.45

Tested by

no test coverage detected