[Python-checkins] bpo-44808: Fix test_inspect in refleak mode (GH-27544)

miss-islington webhook-mailer at python.org
Mon Aug 2 09:41:39 EDT 2021


https://github.com/python/cpython/commit/a1eaa74d9dcd973ec278cefc22aac7f514faee4b
commit: a1eaa74d9dcd973ec278cefc22aac7f514faee4b
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-08-02T06:41:08-07:00
summary:

bpo-44808: Fix test_inspect in refleak mode (GH-27544)

(cherry picked from commit 626d397cc1612ea5eef153dd910834c2ee00ddbd)

Co-authored-by: Pablo Galindo Salgado <Pablogsal at gmail.com>

files:
M Lib/test/test_inspect.py

diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index b664c14020f35..157f315999c42 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -587,11 +587,12 @@ def test_getsource_on_code_object(self):
 
 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



More information about the Python-checkins mailing list