[Fred] > Perhaps it should hold onto the module as well? That would avoid it > getting cleaned up before possibly dependent modules. > For the test case problem, perhaps there should be a list of > exceptional modules that don't get cleaned up by regrtest once they > appear. encodings and warnings would probably both need to be on the > list. This list should probably be in the sys module; it would also > be useful for the RollbackImporter in the unittestgui.py script that > comes with the separate PyUnit package. I expect the problem is intractable. Here's a revealing experiment: add this block to the start of test___all__.check_all(): if modname in sys.modules: del sys.modules[modname] That is, just prior to test___all__ trying to import a module, remove *only* that module from sys.modules if it's already there. Sounds pretty harmless, right? But on Windows, it causes 28 standard tests to fail (possibly more on Linux): 28 tests failed: test___all__ test_difflib test_email test_fileinput test_fnmatch test_future test_gettext test_glob test_global test_htmllib test_htmlparser test_inspect test_mimetypes test_mmap test_os test_pyclbr test_re test_regex test_repr test_scope test_sre test_strftime test_strop test_sundry test_tokenize test_urllib2 test_xmllib test_xmlrpc Trying to figure which modules "hurt" turns out to be a nightmare. Here's the minimal set that allows the test suite to pass again on Windows, using the default test order: if modname in sys.modules: if modname not in ( "copy_reg", "os", "sgmllib", "sre", "tempfile", "tokenize", "warnings", ): del sys.modules[modname] Am I gonna check that in? Fat chance <wink>.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4