]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-107458: fix test_tools refleak (#107577)
authorKumar Aditya <kumaraditya@python.org>
Thu, 3 Aug 2023 06:36:02 +0000 (12:06 +0530)
committerGitHub <noreply@github.com>
Thu, 3 Aug 2023 06:36:02 +0000 (06:36 +0000)
Lib/test/test_tools/test_sundry.py

index 2f8ba272164d32f8b90419a565a4e747ac29ea9a..d0b702d392cdf6940832610dd176aeb7c8d15b1a 100644 (file)
@@ -19,17 +19,11 @@ class TestSundryScripts(unittest.TestCase):
     # cleanly the logging module.
     @import_helper.mock_register_at_fork
     def test_sundry(self, mock_os):
-        old_modules = import_helper.modules_setup()
-        try:
-            for fn in os.listdir(scriptsdir):
-                if not fn.endswith('.py'):
-                    continue
-
-                name = fn[:-3]
-                import_tool(name)
-        finally:
-            # Unload all modules loaded in this test
-            import_helper.modules_cleanup(*old_modules)
+        for fn in os.listdir(scriptsdir):
+            if not fn.endswith('.py'):
+                continue
+            name = fn[:-3]
+            import_tool(name)
 
 
 if __name__ == '__main__':