changeset 33974:1be228b96030

tests: update test-fncache to pass our import checker
author Augie Fackler <raf@durin42.com>
date Tue, 22 Aug 2017 15:51:12 -0400
parents efa6a420ba57
children 04518bd58e8a
files tests/test-fncache.t
diffstat 1 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-fncache.t	Tue Aug 22 15:51:06 2017 -0400
+++ b/tests/test-fncache.t	Tue Aug 22 15:51:12 2017 -0400
@@ -205,9 +205,9 @@
 Aborting lock does not prevent fncache writes
 
   $ cat > exceptionext.py <<EOF
+  > from __future__ import absolute_import
   > import os
-  > from mercurial import commands, error
-  > from mercurial.extensions import wrapcommand, wrapfunction
+  > from mercurial import commands, error, extensions
   > 
   > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs):
   >     def releasewrap():
@@ -217,7 +217,7 @@
   >     return l
   > 
   > def reposetup(ui, repo):
-  >     wrapfunction(repo, '_lock', lockexception)
+  >     extensions.wrapfunction(repo, '_lock', lockexception)
   > 
   > cmdtable = {}
   > 
@@ -236,7 +236,7 @@
   >             wlock.release()
   > 
   > def extsetup(ui):
-  >     wrapcommand(commands.table, "commit", commitwrap)
+  >     extensions.wrapcommand(commands.table, "commit", commitwrap)
   > EOF
   $ extpath=`pwd`/exceptionext.py
   $ hg init fncachetxn
@@ -252,9 +252,9 @@
 Aborting transaction prevents fncache change
 
   $ cat > ../exceptionext.py <<EOF
+  > from __future__ import absolute_import
   > import os
-  > from mercurial import commands, error, localrepo
-  > from mercurial.extensions import wrapfunction
+  > from mercurial import commands, error, extensions, localrepo
   > 
   > def wrapper(orig, self, *args, **kwargs):
   >     tr = orig(self, *args, **kwargs)
@@ -265,7 +265,8 @@
   >     return tr
   > 
   > def uisetup(ui):
-  >     wrapfunction(localrepo.localrepository, 'transaction', wrapper)
+  >     extensions.wrapfunction(
+  >         localrepo.localrepository, 'transaction', wrapper)
   > 
   > cmdtable = {}
   > 
@@ -287,9 +288,15 @@
 Aborted transactions can be recovered later
 
   $ cat > ../exceptionext.py <<EOF
+  > from __future__ import absolute_import
   > import os
-  > from mercurial import commands, error, transaction, localrepo
-  > from mercurial.extensions import wrapfunction
+  > from mercurial import (
+  >   commands,
+  >   error,
+  >   extensions,
+  >   localrepo,
+  >   transaction,
+  > )
   > 
   > def trwrapper(orig, self, *args, **kwargs):
   >     tr = orig(self, *args, **kwargs)
@@ -303,8 +310,10 @@
   >     raise error.Abort("forced transaction failure")
   > 
   > def uisetup(ui):
-  >     wrapfunction(localrepo.localrepository, 'transaction', trwrapper)
-  >     wrapfunction(transaction.transaction, '_abort', abortwrapper)
+  >     extensions.wrapfunction(localrepo.localrepository, 'transaction',
+  >                             trwrapper)
+  >     extensions.wrapfunction(transaction.transaction, '_abort',
+  >                             abortwrapper)
   > 
   > cmdtable = {}
   >