diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-13 01:54:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-13 01:54:28 (GMT) |
commit | 388d91cd474de80355f5a8f6a26e8962813a3128 (patch) | |
tree | b4a1fc7b023974c8bfd2a1a428eb38ee00565807 | |
parent | b544c2b1355571a36fe0c212f92e9b163ceb16af (diff) | |
download | cpython-388d91cd474de80355f5a8f6a26e8962813a3128.zip cpython-388d91cd474de80355f5a8f6a26e8962813a3128.tar.gz cpython-388d91cd474de80355f5a8f6a26e8962813a3128.tar.bz2 |
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
-rw-r--r-- | Lib/test/test_monitoring.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/test/test_monitoring.py b/Lib/test/test_monitoring.py index a4725be..575862b 100644 --- a/Lib/test/test_monitoring.py +++ b/Lib/test/test_monitoring.py @@ -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) |