On Sun, Dec 30, 2012 at 5:54 AM, Stefan Krah <ste...@bytereef.org> wrote:

> Eli Bendersky <eli...@gmail.com> wrote:
> > Yes, this is the solution currently used in test_xml_etree. 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 test_xml_etree manage to ignore it for the Python version
> because they
> > use import_fresh_module.
>
> I ran into the same problem for test_decimal. The only thing that appears
> to work is to set sys.modules['decimal'] explicitly before calling
> dumps()/loads(). See:
>
>    PythonAPItests.test_pickle()
>    ContextAPItests.test_pickle()
>
>
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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to