[PATCH] tests: update test-commit to pass our import checker

Augie Fackler raf at durin42.com
Fri Aug 25 15:28:48 UTC 2017


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1503431401 14400
#      Tue Aug 22 15:50:01 2017 -0400
# Node ID 52b9e56c37c1e62ce338fc0f6cae1d50790186ce
# Parent  d0b32a5f82e4e278e05e6363997bb79510aa9717
tests: update test-commit to pass our import checker

diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -642,9 +642,10 @@ Test making empty commits
   
 verify pathauditor blocks evil filepaths
   $ cat > evil-commit.py <<EOF
-  > from mercurial import ui, hg, context, node
+  > from __future__ import absolute_import
+  > from mercurial import context, hg, node, ui as uimod
   > notrc = u".h\u200cg".encode('utf-8') + '/hgrc'
-  > u = ui.ui.load()
+  > u = uimod.ui.load()
   > r = hg.repository(u, '.')
   > def filectxfn(repo, memctx, path):
   >     return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
@@ -666,9 +667,10 @@ verify pathauditor blocks evil filepaths
   $ hg rollback -f
   repository tip rolled back to revision 2 (undo commit)
   $ cat > evil-commit.py <<EOF
-  > from mercurial import ui, hg, context, node
+  > from __future__ import absolute_import
+  > from mercurial import context, hg, node, ui as uimod
   > notrc = "HG~1/hgrc"
-  > u = ui.ui.load()
+  > u = uimod.ui.load()
   > r = hg.repository(u, '.')
   > def filectxfn(repo, memctx, path):
   >     return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
@@ -684,9 +686,10 @@ verify pathauditor blocks evil filepaths
   $ hg rollback -f
   repository tip rolled back to revision 2 (undo commit)
   $ cat > evil-commit.py <<EOF
-  > from mercurial import ui, hg, context, node
+  > from __future__ import absolute_import
+  > from mercurial import context, hg, node, ui as uimod
   > notrc = "HG8B6C~2/hgrc"
-  > u = ui.ui.load()
+  > u = uimod.ui.load()
   > r = hg.repository(u, '.')
   > def filectxfn(repo, memctx, path):
   >     return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')


More information about the Mercurial-devel mailing list