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

This commit is contained in:
Pablo Galindo Salgado 2021-08-02 12:54:20 +01:00 committed by GitHub
parent 414dcb13aa
commit 626d397cc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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