Skip to content

Commit 14fbd4e

Browse files
gh-107446: Fix test_inspect.test_class_with_method_from_other_module when ran multiple times (#107451)
Co-authored-by: Kumar Aditya <[email protected]>
1 parent ed4a978 commit 14fbd4e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/test/test_inspect.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,9 @@ def f(self):
990990
with DirsOnSysPath(tempdir):
991991
import inspect_actual
992992
self.assertIn("correct", inspect.getsource(inspect_actual.A))
993+
# Remove the module from sys.modules to force it to be reloaded.
994+
# This is necessary when the test is run multiple times.
995+
sys.modules.pop("inspect_actual")
993996

994997
@unittest.skipIf(
995998
support.is_emscripten or support.is_wasi,

0 commit comments

Comments
 (0)