Mercurial > hg
diff tests/test-ctxmanager.py @ 28801:441491aba8c3
test-ctxmanager: stop direct symbol import of mercurial.util
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 05 Apr 2016 23:13:52 +0900 |
parents | 4a7dc29bfad8 |
children | 68c43a416585 |
line wrap: on
line diff
--- 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)