Author: Armin Rigo <[email protected]>
Branch:
Changeset: r64847:92546f437072
Date: 2013-06-11 12:40 +0200
http://bitbucket.org/pypy/pypy/changeset/92546f437072/
Log: Issue #1514 A test for reimporting built-in modules (as opposed to
reloading them).
diff --git a/pypy/module/imp/test/test_import.py
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -565,6 +565,22 @@
assert sys.path is oldpath
assert 'setdefaultencoding' in dir(sys)
+ def test_reimport_builtin(self):
+ # ...but not reload()!
+ import sys
+ oldpath = sys.path
+ sys.setdefaultencoding = "<test_reimport_builtin removed this>"
+
+ del sys.modules['sys']
+ import sys as sys1
+ assert sys.modules['sys'] is sys1 is sys
+
+ assert sys.path is oldpath
+ assert sys.setdefaultencoding == "<test_reimport_builtin removed this>"
+
+ reload(sys) # fix it for people that want 'setdefaultencoding'
+ assert sys.setdefaultencoding != "<test_reimport_builtin removed this>"
+
def test_reload_infinite(self):
import infinite_reload
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit