original) (raw)
(On Sun, Dec 30, 2012 at 5:54 AM, Stefan Krah <stefan@bytereef.org> wrote:
Eli Bendersky <eliben@gmail.com> wrote:I ran into the same problem for test\_decimal. The only thing that appears
\> 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.
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.
I'm still curious about the test-in-clean-env question though.
Eli