Skip to content

Commit

Permalink
GH-107458: fix test_tools refleak (#107577)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 authored Aug 3, 2023
1 parent 62a3a15 commit 46366ca
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions Lib/test/test_tools/test_sundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down

0 comments on commit 46366ca

Please sign in to comment.