mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
gh-109357: Fix test_monitoring.test_gh108976() (#109358)
The test now calls free_tool_id() so it can be run multiple times in the same process. For example, the following command no longer fails: python -m test test_monitoring -R 3:3
This commit is contained in:
parent
b544c2b135
commit
388d91cd47
1 changed files with 1 additions and 0 deletions
|
@ -1721,6 +1721,7 @@ class TestRegressions(MonitoringTestBase, unittest.TestCase):
|
||||||
|
|
||||||
def test_gh108976(self):
|
def test_gh108976(self):
|
||||||
sys.monitoring.use_tool_id(0, "test")
|
sys.monitoring.use_tool_id(0, "test")
|
||||||
|
self.addCleanup(sys.monitoring.free_tool_id, 0)
|
||||||
sys.monitoring.set_events(0, 0)
|
sys.monitoring.set_events(0, 0)
|
||||||
sys.monitoring.register_callback(0, E.LINE, lambda *args: sys.monitoring.set_events(0, 0))
|
sys.monitoring.register_callback(0, E.LINE, lambda *args: sys.monitoring.set_events(0, 0))
|
||||||
sys.monitoring.register_callback(0, E.INSTRUCTION, lambda *args: 0)
|
sys.monitoring.register_callback(0, E.INSTRUCTION, lambda *args: 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue