summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_monitoring.py
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2024-04-03 13:11:36 (GMT)
committerGitHub <noreply@github.com>2024-04-03 13:11:36 (GMT)
commitea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e (patch)
tree7fc58f8dcd7513427c7ea2ff9d7bad523be1118a /Lib/test/test_monitoring.py
parent2ec6bb4111d2c03c1cac02b27c74beee7e5a2a05 (diff)
downloadcpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.zip
cpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.tar.gz
cpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.tar.bz2
gh-116303: Skip test module dependent tests if test modules are unavailable (#117341)
Diffstat (limited to 'Lib/test/test_monitoring.py')
-rw-r--r--Lib/test/test_monitoring.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_monitoring.py b/Lib/test/test_monitoring.py
index 58441ef..11c61bc 100644
--- a/Lib/test/test_monitoring.py
+++ b/Lib/test/test_monitoring.py
@@ -11,6 +11,7 @@ import unittest
import asyncio
from test import support
from test.support import requires_specialization, script_helper
+from test.support.import_helper import import_module
PAIR = (0,1)
@@ -1829,15 +1830,15 @@ class TestRegressions(MonitoringTestBase, unittest.TestCase):
class TestOptimizer(MonitoringTestBase, unittest.TestCase):
def setUp(self):
- import _testinternalcapi
+ _testinternalcapi = import_module("_testinternalcapi")
self.old_opt = _testinternalcapi.get_optimizer()
opt = _testinternalcapi.new_counter_optimizer()
_testinternalcapi.set_optimizer(opt)
super(TestOptimizer, self).setUp()
def tearDown(self):
- import _testinternalcapi
super(TestOptimizer, self).tearDown()
+ import _testinternalcapi
_testinternalcapi.set_optimizer(self.old_opt)
def test_for_loop(self):