summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2023-08-03 15:04:03 (GMT)
committerGitHub <noreply@github.com>2023-08-03 15:04:03 (GMT)
commit14fbd4e6b16dcbcbff448b047f7e2faa27bbedba (patch)
treee7eafad28ef1f10e748044af8a0df7b0ef22c711
parented4a978449c856372d1a7cd389f91cafe2581c87 (diff)
downloadcpython-14fbd4e6b16dcbcbff448b047f7e2faa27bbedba.zip
cpython-14fbd4e6b16dcbcbff448b047f7e2faa27bbedba.tar.gz
cpython-14fbd4e6b16dcbcbff448b047f7e2faa27bbedba.tar.bz2
gh-107446: Fix test_inspect.test_class_with_method_from_other_module when ran multiple times (#107451)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
-rw-r--r--Lib/test/test_inspect.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 3fbfc07..5c31748 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -990,6 +990,9 @@ class TestBuggyCases(GetSourceBase):
with DirsOnSysPath(tempdir):
import inspect_actual
self.assertIn("correct", inspect.getsource(inspect_actual.A))
+ # Remove the module from sys.modules to force it to be reloaded.
+ # This is necessary when the test is run multiple times.
+ sys.modules.pop("inspect_actual")
@unittest.skipIf(
support.is_emscripten or support.is_wasi,