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

Function test_trace

testing/test_unittest.py:1179–1205  ·  view source on GitHub ↗
(pytester: Pytester, monkeypatch: MonkeyPatch)

Source from the content-addressed store, hash-verified

1177
1178
1179def test_trace(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
1180 calls = []
1181
1182 def check_call(*args, **kwargs):
1183 calls.append((args, kwargs))
1184 assert args == ("runcall",)
1185
1186 class _pdb:
1187 def runcall(*args, **kwargs):
1188 calls.append((args, kwargs))
1189
1190 return _pdb
1191
1192 monkeypatch.setattr("_pytest.debugging.pytestPDB._init_pdb", check_call)
1193
1194 p1 = pytester.makepyfile(
1195 """
1196 import unittest
1197
1198 class MyTestCase(unittest.TestCase):
1199 def test(self):
1200 self.assertEqual('foo', 'foo')
1201 """
1202 )
1203 result = pytester.runpytest("--trace", str(p1))
1204 assert len(calls) == 2
1205 assert result.ret == 0
1206
1207
1208def test_pdb_teardown_called(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:

Callers

nothing calls this directly

Calls 3

setattrMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected