# HG changeset patch # User Yuya Nishihara # Date 1459865632 -32400 # Node ID 441491aba8c383a1a6e2530babb793994b9e005c # Parent 544908ae36ce70ac78fffd6a16f33093eb1128c0 test-ctxmanager: stop direct symbol import of mercurial.util diff -r 544908ae36ce -r 441491aba8c3 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)