Patchwork D7941: py3: wallpaper over demand importer differences on Python 3.5

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2020, 7:43 a.m.
Message ID <differential-rev-PHID-DREV-uz5gu44oa4r2gmchdk6d-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44516/
State New
Headers show

Comments

phabricator - Jan. 18, 2020, 7:43 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  For some reason, Python 3.5 and only Python 3.5's demand importer
  is importing extra parent modules. This is causing test output
  on 3.5 to diverge.
  
  While I'm not thrilled about the divergence in behavior, I don't
  think it is critical enough to warrant fixing in code. So this
  commit teaches our test to recognize the divergent behavior on
  Python 3.5.
  
  Because the test format doesn't support conditional exit codes and
  we were already inside an #if (it also doesn't allow nested #ifs),
  I added a `|| false` to normalize the exit code. The actual exit
  code shouldn't matter here, as we have tests for that elsewhere.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-extension.t

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 20, 2020, 2:01 p.m.
This revision is now accepted and ready to land.
pulkit added a comment.
pulkit accepted this revision.


  > I added a `|| false` to normalize the exit code.
  
  s/false/true in flight

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7941/new/

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

To: indygreg, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel

Patch

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -574,25 +574,35 @@ 
   > NO_CHECK_EOF
 
 Examine module importing.
-
-  $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute)
-  LIB: this is extlibroot.lsub1.lsub2.used
-  LIB: this is extlibroot.lsub1.lsub2.called.func()
-  LIB: this is extlibroot.recursedown.abs.used
-  LIB: this is extlibroot.recursedown.legacy.used
-  LIB: this is extlibroot.shadowing.used
-  ABS: this is absextroot.xsub1.xsub2.used
-  ABS: this is absextroot.xsub1.xsub2.called.func()
+Python 3.5's lazy module importer varies in behavior from ours and the
+one in the standard library at 3.6+. This is not desirable. But it is
+a corner case in behavior and we don't expect many people to be running
+into it.
 
-  $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative)
-  LIB: this is extlibroot.lsub1.lsub2.used
-  LIB: this is extlibroot.lsub1.lsub2.called.func()
-  LIB: this is extlibroot.recursedown.abs.used
-  LIB: this is extlibroot.recursedown.legacy.used
-  LIB: this is extlibroot.shadowing.used
-  REL: this is absextroot.xsub1.xsub2.used
-  REL: this is absextroot.xsub1.xsub2.called.func()
-  REL: this relimporter imports 'this is absextroot.relimportee'
+  $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute) || true
+  LIB: this is extlibroot.lsub1.lsub2.used (no-pyexact35 !)
+  LIB: this is extlibroot.lsub1.lsub2.called.func() (no-pyexact35 !)
+  LIB: this is extlibroot.recursedown.abs.used (no-pyexact35 !)
+  LIB: this is extlibroot.recursedown.legacy.used (no-pyexact35 !)
+  LIB: this is extlibroot.shadowing.used (no-pyexact35 !)
+  ABS: this is absextroot.xsub1.xsub2.used (no-pyexact35 !)
+  ABS: this is absextroot.xsub1.xsub2.called.func() (no-pyexact35 !)
+  *** failed to import extension absextroot from $TESTTMP/absextroot: extlibroot.lsub1.lsub2.unused is loaded unintentionally (pyexact35 !)
+  hg: unknown command 'showabsolute' (pyexact35 !)
+  (use 'hg help' for a list of commands) (pyexact35 !)
+
+  $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative) || true
+  LIB: this is extlibroot.lsub1.lsub2.used (no-pyexact35 !)
+  LIB: this is extlibroot.lsub1.lsub2.called.func() (no-pyexact35 !)
+  LIB: this is extlibroot.recursedown.abs.used (no-pyexact35 !)
+  LIB: this is extlibroot.recursedown.legacy.used (no-pyexact35 !)
+  LIB: this is extlibroot.shadowing.used (no-pyexact35 !)
+  REL: this is absextroot.xsub1.xsub2.used (no-pyexact35 !)
+  REL: this is absextroot.xsub1.xsub2.called.func() (no-pyexact35 !)
+  REL: this relimporter imports 'this is absextroot.relimportee' (no-pyexact35 !)
+  *** failed to import extension absextroot from $TESTTMP/absextroot: extlibroot.lsub1.lsub2.unused is loaded unintentionally (pyexact35 !)
+  hg: unknown command 'showrelative' (pyexact35 !)
+  (did you mean shelve?) (pyexact35 !)
 
 Examine whether sub-module is imported relatively as expected.