MCPcopy Index your code
hub / github.com/python/cpython / check_leak

Method check_leak

Lib/test/test_regrtest.py:1282–1304  ·  view source on GitHub ↗
(self, code, what, *, run_workers=False)

Source from the content-addressed store, hash-verified

1280
1281 @support.requires_jit_disabled
1282 def check_leak(self, code, what, *, run_workers=False):
1283 test = self.create_test('huntrleaks', code=code)
1284
1285 filename = 'reflog.txt'
1286 self.addCleanup(os_helper.unlink, filename)
1287 cmd = ['--huntrleaks', '3:3:']
1288 if run_workers:
1289 cmd.append('-j1')
1290 cmd.append(test)
1291 output = self.run_tests(*cmd,
1292 exitcode=EXITCODE_BAD_TEST,
1293 stderr=subprocess.STDOUT)
1294 self.check_executed_tests(output, [test], failed=test, stats=1)
1295
1296 line = r'beginning 6 repetitions. .*\n123:456\n[.0-9X]{3} 111\n'
1297 self.check_line(output, line)
1298
1299 line2 = '%s leaked [1, 1, 1] %s, sum=3\n' % (test, what)
1300 self.assertIn(line2, output)
1301
1302 with open(filename) as fp:
1303 reflog = fp.read()
1304 self.assertIn(line2, reflog)
1305
1306 @unittest.skipUnless(support.Py_DEBUG, 'need a debug build')
1307 def check_huntrleaks(self, *, run_workers: bool):

Callers 2

check_huntrleaksMethod · 0.95

Calls 9

run_testsMethod · 0.95
create_testMethod · 0.80
addCleanupMethod · 0.80
check_executed_testsMethod · 0.80
check_lineMethod · 0.80
assertInMethod · 0.80
openFunction · 0.50
appendMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected