[PATCH 2 of 2] test-ctxmanager: fix Python 2.6 compatibility problem

Augie Fackler raf at durin42.com
Thu Jan 14 13:25:48 CST 2016


On Thu, Jan 14, 2016 at 09:31:08AM -0800, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1452792663 28800
> #      Thu Jan 14 09:31:03 2016 -0800
> # Node ID 1e0d2dbea1dea1f283562667316904a3ec05a356
> # Parent  e0d9c51605b76a3aaf5e694cd251d9af17032780
> test-ctxmanager: fix Python 2.6 compatibility problem

Queued these, thanks.

>
> diff --git a/tests/test-ctxmanager.py b/tests/test-ctxmanager.py
> --- a/tests/test-ctxmanager.py
> +++ b/tests/test-ctxmanager.py
> @@ -55,21 +55,23 @@ class test_ctxmanager(unittest.TestCase)
>      def test_raise_on_enter(self):
>          trace = []
>          addtrace = trace.append
> -        with self.assertRaises(ctxerror):
> +        def go():
>              with ctxmanager(ctxmgr('a', addtrace),
>                             lambda: raise_on_enter('b', addtrace)) as c:
>                  c.enter()
>                  addtrace('unreachable')
> +        self.assertRaises(ctxerror, go)
>          self.assertEqual(trace, [('enter', 'a'), ('raise', 'b'), ('exit', 'a')])
>
>      def test_raise_on_exit(self):
>          trace = []
>          addtrace = trace.append
> -        with self.assertRaises(ctxerror):
> +        def go():
>              with ctxmanager(ctxmgr('a', addtrace),
>                             lambda: raise_on_exit('b', addtrace)) as c:
>                  c.enter()
>                  addtrace('running')
> +        self.assertRaises(ctxerror, go)
>          self.assertEqual(trace, [('enter', 'a'), ('enter', 'b'), 'running',
>                                   ('raise', 'b'), ('exit', 'a')])
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list