Patchwork [2,of,9] test-ctxmanager: stop direct symbol import of mercurial.util

login
register
mail settings
Submitter Yuya Nishihara
Date April 5, 2016, 4:05 p.m.
Message ID <4a78d1167d58c3744e55.1459872310@mimosa>
Download mbox | patch
Permalink /patch/14373/
State Accepted
Headers show

Comments

Yuya Nishihara - April 5, 2016, 4:05 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1459865632 -32400
#      Tue Apr 05 23:13:52 2016 +0900
# Node ID 4a78d1167d58c3744e55ac65e988b372dc44be7f
# Parent  084a6924ea81ee540555e35a45ed67fa64020f78
test-ctxmanager: stop direct symbol import of mercurial.util

Patch

diff --git a/tests/test-ctxmanager.py b/tests/test-ctxmanager.py
--- a/tests/test-ctxmanager.py
+++ b/tests/test-ctxmanager.py
@@ -3,7 +3,7 @@  from __future__ import absolute_import
 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 @@  class test_ctxmanager(unittest.TestCase)
     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 @@  class test_ctxmanager(unittest.TestCase)
         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 @@  class test_ctxmanager(unittest.TestCase)
         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)