[3.12] gh-106193: Rename and fix duplicated tests in test_monitoring (GH-109139) (#110897)

This commit is contained in:
Hugo van Kemenade 2023-10-15 20:32:08 +03:00 committed by GitHub
parent 97f4b667e7
commit 9c39149b4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1168,7 +1168,7 @@ class TestLineAndInstructionEvents(CheckEvents):
('instruction', 'func1', 14), ('instruction', 'func1', 14),
('line', 'get_events', 11)]) ('line', 'get_events', 11)])
class TestInstallIncrementallly(MonitoringTestBase, unittest.TestCase): class TestInstallIncrementally(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,)):
try: try:
@ -1197,19 +1197,19 @@ class TestInstallIncrementallly(MonitoringTestBase, unittest.TestCase):
MUST_INCLUDE_LI = [ MUST_INCLUDE_LI = [
('instruction', 'func1', 2), ('instruction', 'func1', 2),
('line', 'func1', 1), ('line', 'func1', 2),
('instruction', 'func1', 4), ('instruction', 'func1', 4),
('instruction', 'func1', 6)] ('instruction', 'func1', 6)]
def test_line_then_instruction(self): def test_line_then_instruction(self):
recorders = [ LineRecorder, InstructionRecorder ] recorders = [ LineRecorder, InstructionRecorder ]
self.check_events(self.func1, self.check_events(self.func1,
recorders = recorders, must_include = self.EXPECTED_LI) recorders = recorders, must_include = self.MUST_INCLUDE_LI)
def test_instruction_then_line(self): def test_instruction_then_line(self):
recorders = [ InstructionRecorder, LineRecorderLowNoise ] recorders = [ InstructionRecorder, LineRecorder ]
self.check_events(self.func1, self.check_events(self.func1,
recorders = recorders, must_include = self.EXPECTED_LI) recorders = recorders, must_include = self.MUST_INCLUDE_LI)
@staticmethod @staticmethod
def func2(): def func2():
@ -1224,12 +1224,12 @@ class TestInstallIncrementallly(MonitoringTestBase, unittest.TestCase):
def test_line_then_instruction(self): def test_call_then_instruction(self):
recorders = [ CallRecorder, InstructionRecorder ] recorders = [ CallRecorder, InstructionRecorder ]
self.check_events(self.func2, self.check_events(self.func2,
recorders = recorders, must_include = self.MUST_INCLUDE_CI) recorders = recorders, must_include = self.MUST_INCLUDE_CI)
def test_instruction_then_line(self): def test_instruction_then_call(self):
recorders = [ InstructionRecorder, CallRecorder ] recorders = [ InstructionRecorder, CallRecorder ]
self.check_events(self.func2, self.check_events(self.func2,
recorders = recorders, must_include = self.MUST_INCLUDE_CI) recorders = recorders, must_include = self.MUST_INCLUDE_CI)