mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-109156: Add tests for de-instrumenting instructions with instrumented lines (GH-109157)
This commit is contained in:
parent
a0c06a4f93
commit
d69805b38a
2 changed files with 18 additions and 0 deletions
|
@ -1152,6 +1152,23 @@ class TestLineAndInstructionEvents(CheckEvents):
|
||||||
('instruction', 'func1', 14),
|
('instruction', 'func1', 14),
|
||||||
('line', 'get_events', 11)])
|
('line', 'get_events', 11)])
|
||||||
|
|
||||||
|
def test_turn_off_only_instruction(self):
|
||||||
|
"""
|
||||||
|
LINE events should be recorded after INSTRUCTION event is turned off
|
||||||
|
"""
|
||||||
|
events = []
|
||||||
|
def line(*args):
|
||||||
|
events.append("line")
|
||||||
|
sys.monitoring.set_events(TEST_TOOL, 0)
|
||||||
|
sys.monitoring.register_callback(TEST_TOOL, E.LINE, line)
|
||||||
|
sys.monitoring.register_callback(TEST_TOOL, E.INSTRUCTION, lambda *args: None)
|
||||||
|
sys.monitoring.set_events(TEST_TOOL, E.LINE | E.INSTRUCTION)
|
||||||
|
sys.monitoring.set_events(TEST_TOOL, E.LINE)
|
||||||
|
events = []
|
||||||
|
a = 0
|
||||||
|
sys.monitoring.set_events(TEST_TOOL, 0)
|
||||||
|
self.assertGreater(len(events), 0)
|
||||||
|
|
||||||
class TestInstallIncrementallly(MonitoringTestBase, unittest.TestCase):
|
class TestInstallIncrementallly(MonitoringTestBase, unittest.TestCase):
|
||||||
|
|
||||||
def check_events(self, func, must_include, tool=TEST_TOOL, recorders=(ExceptionRecorder,)):
|
def check_events(self, func, must_include, tool=TEST_TOOL, recorders=(ExceptionRecorder,)):
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Add tests for de-instrumenting instructions while keeping the instrumentation for lines
|
Loading…
Add table
Add a link
Reference in a new issue