File: test_compat.py

package info (click to toggle)
bup 0.33.9-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,712 kB
  • sloc: python: 15,897; sh: 5,764; ansic: 2,965; pascal: 669; makefile: 21
file content (30 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

from __future__ import absolute_import, print_function

from bup.compat import pending_raise
from wvpytest import wvpasseq

def test_pending_raise():
    outer = Exception('outer')
    inner = Exception('inner')

    try:
        try:
            raise outer
        except Exception as ex:
            with pending_raise(ex):
                pass
    except Exception as ex:
        wvpasseq(outer, ex)
        wvpasseq(None, getattr(outer, '__context__', None))

    try:
        try:
            raise outer
        except Exception as ex:
            with pending_raise(ex):
                raise inner
    except Exception as ex:
        wvpasseq(inner, ex)
        wvpasseq(None, getattr(outer, '__context__', None))
        wvpasseq(outer, getattr(inner, '__context__', None))