diff tests/test-demandimport.py @ 32448:91a2ec8e7fa0

demandimport: stop overriding __getattribute__() Proxy __dict__ and __doc__ explicitly instead. I'm not sure which is less evil, but this seems slightly simpler than hooking all attribute accesses.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 28 Apr 2017 00:01:22 +0900
parents 252d2260c74e
children eddca62d9e64
line wrap: on
line diff
--- a/tests/test-demandimport.py	Fri Apr 28 23:46:16 2017 +0900
+++ b/tests/test-demandimport.py	Fri Apr 28 00:01:22 2017 +0900
@@ -69,6 +69,17 @@
 print("re.stderr =", f(re.stderr))
 print("re =", f(re))
 
+# Test access to special attributes through demandmod proxy
+from mercurial import pvec as pvecproxy
+print("pvecproxy =", f(pvecproxy))
+print("pvecproxy.__doc__ = %r"
+      % (' '.join(pvecproxy.__doc__.split()[:3]) + ' ...'))
+print("pvecproxy.__name__ = %r" % pvecproxy.__name__)
+# __name__ must be accessible via __dict__ so the relative imports can be
+# resolved
+print("pvecproxy.__dict__['__name__'] = %r" % pvecproxy.__dict__['__name__'])
+print("pvecproxy =", f(pvecproxy))
+
 import contextlib
 print("contextlib =", f(contextlib))
 try: