diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-23 11:37:20 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-23 11:37:20 (GMT) |
commit | 3728d6ced09eb3adac2e9fec6be38e1598720067 (patch) | |
tree | 70008dae2aea975cb3604173bdccfd66ac2d79cc /Lib/test/test_tracemalloc.py | |
parent | ed3b0bca3ef9d7bdbb8bd8e67e60e85f5a336da0 (diff) | |
download | cpython-3728d6ced09eb3adac2e9fec6be38e1598720067.zip cpython-3728d6ced09eb3adac2e9fec6be38e1598720067.tar.gz cpython-3728d6ced09eb3adac2e9fec6be38e1598720067.tar.bz2 |
Issue #18874: Remove tracemalloc.set_traceback_limit()
tracemalloc.start() now has an option nframe parameter
Diffstat (limited to 'Lib/test/test_tracemalloc.py')
-rw-r--r-- | Lib/test/test_tracemalloc.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py index ecb5aee..1d15667 100644 --- a/Lib/test/test_tracemalloc.py +++ b/Lib/test/test_tracemalloc.py @@ -83,8 +83,7 @@ class TestTracemallocEnabled(unittest.TestCase): if tracemalloc.is_tracing(): self.skipTest("tracemalloc must be stopped before the test") - tracemalloc.set_traceback_limit(1) - tracemalloc.start() + tracemalloc.start(1) def tearDown(self): tracemalloc.stop() @@ -109,20 +108,18 @@ class TestTracemallocEnabled(unittest.TestCase): def test_set_traceback_limit(self): obj_size = 10 - nframe = tracemalloc.get_traceback_limit() - self.addCleanup(tracemalloc.set_traceback_limit, nframe) - - self.assertRaises(ValueError, tracemalloc.set_traceback_limit, -1) + tracemalloc.stop() + self.assertRaises(ValueError, tracemalloc.start, -1) - tracemalloc.clear_traces() - tracemalloc.set_traceback_limit(10) + tracemalloc.stop() + tracemalloc.start(10) obj2, obj2_traceback = allocate_bytes(obj_size) traceback = tracemalloc.get_object_traceback(obj2) self.assertEqual(len(traceback), 10) self.assertEqual(traceback, obj2_traceback) - tracemalloc.clear_traces() - tracemalloc.set_traceback_limit(1) + tracemalloc.stop() + tracemalloc.start(1) obj, obj_traceback = allocate_bytes(obj_size) traceback = tracemalloc.get_object_traceback(obj) self.assertEqual(len(traceback), 1) @@ -163,8 +160,8 @@ class TestTracemallocEnabled(unittest.TestCase): return allocate_bytes3(size) # Ensure that two identical tracebacks are not duplicated - tracemalloc.clear_traces() - tracemalloc.set_traceback_limit(4) + tracemalloc.stop() + tracemalloc.start(4) obj_size = 123 obj1, obj1_traceback = allocate_bytes4(obj_size) obj2, obj2_traceback = allocate_bytes4(obj_size) |