Patchwork D2287: tests: avoid referring to pvec in demandimport test

login
register
mail settings
Submitter phabricator
Date Feb. 16, 2018, 7:40 p.m.
Message ID <differential-rev-PHID-DREV-caek4w4wohwfvdtnztl4-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27992/
State Superseded
Headers show

Comments

phabricator - Feb. 16, 2018, 7:40 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm going to delete pvec, so this patch replaces it by the error
  module in the demandimport test (any module works). However, since the
  error module had already been loaded at this point in the test (via
  the util module), I moved it earlier in the test so it's still not
  loaded (although I'm not sure if that's even relevant to the test).

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2287

AFFECTED FILES
  tests/test-demandimport.py
  tests/test-demandimport.py.out

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 16, 2018, 10:06 p.m.
durin42 added a comment.


  +1 on decoupling this from pvec, but per discussion on https://phab.mercurial-scm.org/D2288 revise commit message per pvec's (temporary) stay of execution?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2287

To: martinvonz, #hg-reviewers
Cc: durin42, mercurial-devel
phabricator - Feb. 16, 2018, 10:21 p.m.
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D2287#37835, @durin42 wrote:
  
  > +1 on decoupling this from pvec, but per discussion on https://phab.mercurial-scm.org/D2288 revise commit message per pvec's (temporary) stay of execution?
  
  
  Done

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2287

To: martinvonz, #hg-reviewers
Cc: durin42, mercurial-devel

Patch

diff --git a/tests/test-demandimport.py.out b/tests/test-demandimport.py.out
--- a/tests/test-demandimport.py.out
+++ b/tests/test-demandimport.py.out
@@ -1,4 +1,9 @@ 
 node = <module 'mercurial.node' from '?'>
+errorproxy = <unloaded module 'error'>
+errorproxy.__doc__ = 'Mercurial exceptions. This ...'
+errorproxy.__name__ = 'mercurial.error'
+errorproxy.__dict__['__name__'] = 'mercurial.error'
+errorproxy = <proxied module 'error'>
 os = <unloaded module 'os'>
 os.system = <built-in function system>
 os = <module 'os' from '?'>
@@ -19,11 +24,6 @@ 
 re = <unloaded module 'sys'>
 re.stderr = <open file '<whatever>', mode 'w' at 0x?>
 re = <proxied module 'sys'>
-pvecproxy = <unloaded module 'pvec'>
-pvecproxy.__doc__ = 'A "pvec" is ...'
-pvecproxy.__name__ = 'mercurial.pvec'
-pvecproxy.__dict__['__name__'] = 'mercurial.pvec'
-pvecproxy = <proxied module 'pvec'>
 contextlib = <unloaded module 'contextlib'>
 contextlib.unknownattr = ImportError: cannot import name unknownattr
 __import__('contextlib', ..., ['unknownattr']) = <module 'contextlib' from '?'>
diff --git a/tests/test-demandimport.py b/tests/test-demandimport.py
--- a/tests/test-demandimport.py
+++ b/tests/test-demandimport.py
@@ -41,6 +41,17 @@ 
 del os.environ['HGDEMANDIMPORT']
 demandimport.enable()
 
+# Test access to special attributes through demandmod proxy
+from mercurial import error as errorproxy
+print("errorproxy =", f(errorproxy))
+print("errorproxy.__doc__ = %r"
+      % (' '.join(errorproxy.__doc__.split()[:3]) + ' ...'))
+print("errorproxy.__name__ = %r" % errorproxy.__name__)
+# __name__ must be accessible via __dict__ so the relative imports can be
+# resolved
+print("errorproxy.__dict__['__name__'] = %r" % errorproxy.__dict__['__name__'])
+print("errorproxy =", f(errorproxy))
+
 import os
 
 print("os =", f(os))
@@ -79,17 +90,6 @@ 
 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: