(pytester: Pytester)
| 1388 | |
| 1389 | |
| 1390 | def 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 | |
| 1425 | def test_tee_stdio_captures_and_live_prints(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected