mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-103845: Remove line & instruction instrumentations before adding them back (GH-103851)
This commit is contained in:
parent
0a5cd984b2
commit
bcea36f8db
3 changed files with 70 additions and 8 deletions
|
@ -876,6 +876,42 @@ class TestLineAndInstructionEvents(CheckEvents):
|
|||
('instruction', 'func3', 34),
|
||||
('line', 'check_events', 11)])
|
||||
|
||||
def test_with_restart(self):
|
||||
def func1():
|
||||
line1 = 1
|
||||
line2 = 2
|
||||
line3 = 3
|
||||
|
||||
self.check_events(func1, recorders = LINE_AND_INSTRUCTION_RECORDERS, expected = [
|
||||
('line', 'check_events', 10),
|
||||
('line', 'func1', 1),
|
||||
('instruction', 'func1', 2),
|
||||
('instruction', 'func1', 4),
|
||||
('line', 'func1', 2),
|
||||
('instruction', 'func1', 6),
|
||||
('instruction', 'func1', 8),
|
||||
('line', 'func1', 3),
|
||||
('instruction', 'func1', 10),
|
||||
('instruction', 'func1', 12),
|
||||
('instruction', 'func1', 14),
|
||||
('line', 'check_events', 11)])
|
||||
|
||||
sys.monitoring.restart_events()
|
||||
|
||||
self.check_events(func1, recorders = LINE_AND_INSTRUCTION_RECORDERS, expected = [
|
||||
('line', 'check_events', 10),
|
||||
('line', 'func1', 1),
|
||||
('instruction', 'func1', 2),
|
||||
('instruction', 'func1', 4),
|
||||
('line', 'func1', 2),
|
||||
('instruction', 'func1', 6),
|
||||
('instruction', 'func1', 8),
|
||||
('line', 'func1', 3),
|
||||
('instruction', 'func1', 10),
|
||||
('instruction', 'func1', 12),
|
||||
('instruction', 'func1', 14),
|
||||
('line', 'check_events', 11)])
|
||||
|
||||
class TestInstallIncrementallly(MonitoringTestBase, unittest.TestCase):
|
||||
|
||||
def check_events(self, func, must_include, tool=TEST_TOOL, recorders=(ExceptionRecorder,)):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue