Show More
@@ -3,7 +3,7 b' from __future__ import absolute_import' | |||||
3 | import silenttestrunner |
|
3 | import silenttestrunner | |
4 | import unittest |
|
4 | import unittest | |
5 |
|
5 | |||
6 |
from mercurial |
|
6 | from mercurial import util | |
7 |
|
7 | |||
8 | class contextmanager(object): |
|
8 | class contextmanager(object): | |
9 | def __init__(self, name, trace): |
|
9 | def __init__(self, name, trace): | |
@@ -44,7 +44,7 b' class test_ctxmanager(unittest.TestCase)' | |||||
44 | def test_basics(self): |
|
44 | def test_basics(self): | |
45 | trace = [] |
|
45 | trace = [] | |
46 | addtrace = trace.append |
|
46 | addtrace = trace.append | |
47 | with ctxmanager(ctxmgr('a', addtrace), ctxmgr('b', addtrace)) as c: |
|
47 | with util.ctxmanager(ctxmgr('a', addtrace), ctxmgr('b', addtrace)) as c: | |
48 | a, b = c.enter() |
|
48 | a, b = c.enter() | |
49 | c.atexit(addtrace, ('atexit', 'x')) |
|
49 | c.atexit(addtrace, ('atexit', 'x')) | |
50 | c.atexit(addtrace, ('atexit', 'y')) |
|
50 | c.atexit(addtrace, ('atexit', 'y')) | |
@@ -56,8 +56,8 b' class test_ctxmanager(unittest.TestCase)' | |||||
56 | trace = [] |
|
56 | trace = [] | |
57 | addtrace = trace.append |
|
57 | addtrace = trace.append | |
58 | def go(): |
|
58 | def go(): | |
59 | with ctxmanager(ctxmgr('a', addtrace), |
|
59 | with util.ctxmanager(ctxmgr('a', addtrace), | |
60 | lambda: raise_on_enter('b', addtrace)) as c: |
|
60 | lambda: raise_on_enter('b', addtrace)) as c: | |
61 | c.enter() |
|
61 | c.enter() | |
62 | addtrace('unreachable') |
|
62 | addtrace('unreachable') | |
63 | self.assertRaises(ctxerror, go) |
|
63 | self.assertRaises(ctxerror, go) | |
@@ -67,8 +67,8 b' class test_ctxmanager(unittest.TestCase)' | |||||
67 | trace = [] |
|
67 | trace = [] | |
68 | addtrace = trace.append |
|
68 | addtrace = trace.append | |
69 | def go(): |
|
69 | def go(): | |
70 | with ctxmanager(ctxmgr('a', addtrace), |
|
70 | with util.ctxmanager(ctxmgr('a', addtrace), | |
71 | lambda: raise_on_exit('b', addtrace)) as c: |
|
71 | lambda: raise_on_exit('b', addtrace)) as c: | |
72 | c.enter() |
|
72 | c.enter() | |
73 | addtrace('running') |
|
73 | addtrace('running') | |
74 | self.assertRaises(ctxerror, go) |
|
74 | self.assertRaises(ctxerror, go) |
General Comments 0
You need to be logged in to leave comments.
Login now