test-ctxmanager: stop direct symbol import of mercurial.util
authorYuya Nishihara <yuya@tcha.org>
Tue, 05 Apr 2016 23:13:52 +0900
changeset 28801 441491aba8c3
parent 28800 544908ae36ce
child 28802 b16eacf5347c
test-ctxmanager: stop direct symbol import of mercurial.util
tests/test-ctxmanager.py
--- a/tests/test-ctxmanager.py	Tue Apr 05 23:10:13 2016 +0900
+++ b/tests/test-ctxmanager.py	Tue Apr 05 23:13:52 2016 +0900
@@ -3,7 +3,7 @@
 import silenttestrunner
 import unittest
 
-from mercurial.util import ctxmanager
+from mercurial import util
 
 class contextmanager(object):
     def __init__(self, name, trace):
@@ -44,7 +44,7 @@
     def test_basics(self):
         trace = []
         addtrace = trace.append
-        with ctxmanager(ctxmgr('a', addtrace), ctxmgr('b', addtrace)) as c:
+        with util.ctxmanager(ctxmgr('a', addtrace), ctxmgr('b', addtrace)) as c:
             a, b = c.enter()
             c.atexit(addtrace, ('atexit', 'x'))
             c.atexit(addtrace, ('atexit', 'y'))
@@ -56,8 +56,8 @@
         trace = []
         addtrace = trace.append
         def go():
-            with ctxmanager(ctxmgr('a', addtrace),
-                           lambda: raise_on_enter('b', addtrace)) as c:
+            with util.ctxmanager(ctxmgr('a', addtrace),
+                                 lambda: raise_on_enter('b', addtrace)) as c:
                 c.enter()
                 addtrace('unreachable')
         self.assertRaises(ctxerror, go)
@@ -67,8 +67,8 @@
         trace = []
         addtrace = trace.append
         def go():
-            with ctxmanager(ctxmgr('a', addtrace),
-                           lambda: raise_on_exit('b', addtrace)) as c:
+            with util.ctxmanager(ctxmgr('a', addtrace),
+                                 lambda: raise_on_exit('b', addtrace)) as c:
                 c.enter()
                 addtrace('running')
         self.assertRaises(ctxerror, go)