[Python-checkins] GH-107458: fix test_tools refleak (#107577)

kumaraditya303 webhook-mailer at python.org
Thu Aug 3 02:36:06 EDT 2023


https://github.com/python/cpython/commit/46366ca0486d07fe94c70d00771482c8ef1546fc
commit: 46366ca0486d07fe94c70d00771482c8ef1546fc
branch: main
author: Kumar Aditya <kumaraditya at python.org>
committer: kumaraditya303 <kumaraditya at python.org>
date: 2023-08-03T06:36:02Z
summary:

GH-107458: fix test_tools refleak (#107577)

files:
M Lib/test/test_tools/test_sundry.py

diff --git a/Lib/test/test_tools/test_sundry.py b/Lib/test/test_tools/test_sundry.py
index 2f8ba272164d3..d0b702d392cdf 100644
--- a/Lib/test/test_tools/test_sundry.py
+++ b/Lib/test/test_tools/test_sundry.py
@@ -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__':



More information about the Python-checkins mailing list