summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bdb.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-06-22 12:05:45 (GMT)
committerGitHub <noreply@github.com>2022-06-22 12:05:45 (GMT)
commitc029b552f39200977325d4351803bdd13ddccc4f (patch)
tree984582ca4b4358dde51a1bc1fd94412cff4eafc0 /Lib/test/test_bdb.py
parentca308c13daa722f3669a14f1613da768086beb6a (diff)
downloadcpython-c029b552f39200977325d4351803bdd13ddccc4f.zip
cpython-c029b552f39200977325d4351803bdd13ddccc4f.tar.gz
cpython-c029b552f39200977325d4351803bdd13ddccc4f.tar.bz2
gh-93951: In test_bdb.StateTestCase.test_skip, avoid including auxiliary importers. (GH-93962)
Co-authored-by: Brett Cannon <brett@python.org>
Diffstat (limited to 'Lib/test/test_bdb.py')
-rw-r--r--Lib/test/test_bdb.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_bdb.py b/Lib/test/test_bdb.py
index 6ec5953..87a5ac3 100644
--- a/Lib/test/test_bdb.py
+++ b/Lib/test/test_bdb.py
@@ -59,6 +59,7 @@ from contextlib import contextmanager
from itertools import islice, repeat
from test.support import import_helper
from test.support import os_helper
+from test.support import patch_list
class BdbException(Exception): pass
@@ -713,9 +714,18 @@ class StateTestCase(BaseTestCase):
with TracerRun(self) as tracer:
tracer.runcall(tfunc_main)
+ @patch_list(sys.meta_path)
def test_skip(self):
# Check that tracing is skipped over the import statement in
# 'tfunc_import()'.
+
+ # Remove all but the standard importers.
+ sys.meta_path[:] = (
+ item
+ for item in sys.meta_path
+ if item.__module__.startswith('_frozen_importlib')
+ )
+
code = """
def main():
lno = 3