Commits

Anonymous committed cfadbaf

[modutils] return list of cleaned modules

Closes #255526.

Comments (0)

Files changed (1)

 
 def cleanup_sys_modules(directories):
     """remove submodules of `directories` from `sys.modules`"""
+    cleaned = []
     for modname, module in sys.modules.items():
         modfile = getattr(module, '__file__', None)
         if modfile:
             for directory in directories:
                 if modfile.startswith(directory):
+                    cleaned.append(modname)
                     del sys.modules[modname]
                     break
+    return cleaned
 
 
 def is_python_source(filename):