[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
R. David Murray added the comment: Hmm. What if we made import_fresh_module a context manager, so that the restore of the original module in sys.modules only happened at the end of the context? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Eli Bendersky added the comment: David, how would this help pickle not find _elementtree though? It's already in sys.modules *before* fresh_import is used, because test___all__ put it there. I'm experimenting with just deleting _elementtree from sys.modules before running the tests, so far with little success. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Changes by Eli Bendersky eli...@gmail.com: -- Removed message: http://bugs.python.org/msg178576 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Eli Bendersky added the comment: David, how would this help pickle not find _elementtree though? It's already in sys.modules *before* fresh_import is used, because test___all__ put it there. I'm experimenting with just deleting _elementtree from sys.modules before running the tests, so far with little success. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
R. David Murray added the comment: It would help because import_fresh_module would have updated sys.modules to be the module under test, and would not restore the previously existing entry in sys.modules until after your test had completed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Eli Bendersky added the comment: I'm renaming the issue to just mention the problem, not the initially proposed solution (following the python-dev discussion). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Changes by Daniel Shahaf pyt...@danielsh.fastmail.net: -- nosy: +danielsh ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
New submission from Eli Bendersky: http://mail.python.org/pipermail/python-dev/2012-December/123368.html This came up while investigating some test-order-dependency failures in issue 16076. test___all__ goes over modules that have `__all__` in them and does 'from module import *' on them. This leaves a lot of modules in sys.modules, which may interfere with some tests that do fancy things with sys,modules. In particular, the ElementTree tests have trouble with it because they carefully set up the imports to get the C or the Python version of etree (see issues 15083 and 15075). Would it make sense to save the sys.modules state and restore it in test___all__ so that sys.modules isn't affected by this test? -- assignee: eli.bendersky components: Tests messages: 178547 nosy: eli.bendersky priority: normal severity: normal stage: needs patch status: open title: test___all__ has to save and restore sys.modules while it does all the importing type: behavior versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
R. David Murray added the comment: As Nick pointed out in the thread, getting the correct module imports for C and python versions is what import_fresh_module in test.support is for. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ has to save and restore sys.modules while it does all the importing
Eli Bendersky added the comment: Yes, but pickle doesn't use this helper function. And the problem is because *pickle* tries to __import__ this module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com