]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109357: Fix test_monitoring.test_gh108976() (#109358)
authorVictor Stinner <vstinner@python.org>
Wed, 13 Sep 2023 01:54:28 +0000 (03:54 +0200)
committerGitHub <noreply@github.com>
Wed, 13 Sep 2023 01:54:28 +0000 (01:54 +0000)
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

Lib/test/test_monitoring.py

index a4725be21706ff18cf54974764e01f327349774c..575862b13d7f99fa3f650cc9f12637b55920a94c 100644 (file)
@@ -1721,6 +1721,7 @@ class TestRegressions(MonitoringTestBase, unittest.TestCase):
 
     def test_gh108976(self):
         sys.monitoring.use_tool_id(0, "test")
+        self.addCleanup(sys.monitoring.free_tool_id, 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.INSTRUCTION, lambda *args: 0)