[Python-Dev] test___all__ polluting sys.modules? (original) (raw)
Eli Bendersky eliben at gmail.com
Sun Dec 30 15:19:50 CET 2012
- Previous message: [Python-Dev] test___all__ polluting sys.modules?
- Next message: [Python-Dev] test___all__ polluting sys.modules?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Dec 30, 2012 at 5:54 AM, Stefan Krah <stefan at bytereef.org> wrote:
Eli Bendersky <eliben at gmail.com> wrote: > Yes, this is the solution currently used in testxmletree. However, once > pickling tests are added things stop working. Pickle uses import to import > the module a class belongs to, bypassing all such trickery. So if test_all_ > got elementtree into sys.modules, pickle's import finds it even if all the > tests in testxmletree manage to ignore it for the Python version because they > use importfreshmodule.
I ran into the same problem for testdecimal. The only thing that appears to work is to set sys.modules['decimal'] explicitly before calling dumps()/loads(). See: PythonAPItests.testpickle() ContextAPItests.testpickle() Yes, this seems to have done the trick. Thanks for the suggestion.
I'm still curious about the test-in-clean-env question though.
Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20121230/567bff3f/attachment.html>
- Previous message: [Python-Dev] test___all__ polluting sys.modules?
- Next message: [Python-Dev] test___all__ polluting sys.modules?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]