From 626d397cc1612ea5eef153dd910834c2ee00ddbd Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 2 Aug 2021 12:54:20 +0100 Subject: [PATCH] bpo-44808: Fix test_inspect in refleak mode (GH-27544) --- Lib/test/test_inspect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index a46dc9ba594..b0c42a2dcf6 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -587,11 +587,12 @@ class TestRetrievingSourceCode(GetSourceBase): class TestGetsourceInteractive(unittest.TestCase): def tearDown(self): - mod.ParrotDroppings.__module__ = mod + mod.ParrotDroppings.__module__ = self.mod sys.modules['__main__'] = self.main def test_getclasses_interactive(self): self.main = sys.modules['__main__'] + self.mod = mod.ParrotDroppings.__module__ class MockModule: __file__ = None sys.modules['__main__'] = MockModule