(pytester: Pytester)
| 1212 | |
| 1213 | |
| 1214 | def test_pdb_can_be_rewritten(pytester: Pytester) -> None: |
| 1215 | pytester.makepyfile( |
| 1216 | **{ |
| 1217 | "conftest.py": """ |
| 1218 | import pytest |
| 1219 | pytest.register_assert_rewrite("pdb") |
| 1220 | """, |
| 1221 | "__init__.py": "", |
| 1222 | "pdb.py": """ |
| 1223 | def check(): |
| 1224 | assert 1 == 2 |
| 1225 | """, |
| 1226 | "test_pdb.py": """ |
| 1227 | def test(): |
| 1228 | import pdb |
| 1229 | assert pdb.check() |
| 1230 | """, |
| 1231 | } |
| 1232 | ) |
| 1233 | # Disable debugging plugin itself to avoid: |
| 1234 | # > INTERNALERROR> AttributeError: module 'pdb' has no attribute 'set_trace' |
| 1235 | result = pytester.runpytest_subprocess("-p", "no:debugging", "-vv") |
| 1236 | result.stdout.fnmatch_lines( |
| 1237 | [ |
| 1238 | " def check():", |
| 1239 | "> assert 1 == 2", |
| 1240 | "E assert 1 == 2", |
| 1241 | "E +1", |
| 1242 | "E -2", |
| 1243 | "", |
| 1244 | "pdb.py:2: AssertionError", |
| 1245 | "*= 1 failed in *", |
| 1246 | ] |
| 1247 | ) |
| 1248 | assert result.ret == 1 |
| 1249 | |
| 1250 | |
| 1251 | def test_tee_stdio_captures_and_live_prints(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected