diff options
author | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2012-03-15 13:34:02 +0100 |
---|---|---|
committer | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2012-03-15 13:34:02 +0100 |
commit | edca50607e10aeeccb2f251bd23a02b7c2f079be (patch) | |
tree | a88dc6afaa79db9c41e6fe2e5fc702a8d8454652 | |
parent | 27e22487d92741e52c12e346123830a08f05243c (diff) | |
download | logilab-common-edca50607e10aeeccb2f251bd23a02b7c2f079be.tar.gz |
testlib: ensure DocTest does not alter __builtins__
The DocTest Safety seems to fails and we need our own overlay. Maybe we are
using it wrong?
-- transplanted from 2dddccc63dad
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | testlib.py | 9 |
2 files changed, 22 insertions, 2 deletions
@@ -1,10 +1,23 @@ ChangeLog for logilab.common ============================ - -- +2012-03-22 -- 0.57.2 * texutils: apply_units raise ValueError if string isn'nt valid (closes #88808) + + * daemon: don't call putenv directly + * pytest: do not enable extra warning other than DeprecationWarning. + * testlib: DocTestCase fix builtins pollution after doctest execution. + + * testlib: replace sys.exit with raise ImportError (closes: #84159) + + * fix license in README + + * add trove classifiers (tell about python 3 support for pypi) + + + 2011-10-28 -- 0.57.1 * daemon: change $HOME after dropping privileges (closes #81297) @@ -1214,7 +1214,14 @@ class DocTest(TestCase): suite = doctest.DocTestSuite(self.module) except AttributeError: suite = SkippedSuite() - return suite.run(result) + # doctest may gork the builtins dictionnary + # This happen to the "_" entry used by gettext + old_builtins = __builtins__.copy() + try: + return suite.run(result) + finally: + __builtins__.clear() + __builtins__.update(old_builtins) run = __call__ def test(self): |