In [17]: %xmode plain Exception reporting mode: Plain In [18]: %run simpleerr.py exit An exception has occurred, use %tb to see the full traceback. SystemExit: (1, 'Mode = exit') In [19]: %run simpleerr.py exit 2 An exception has occurred, use %tb to see the full traceback. SystemExit: (2, 'Mode
()
| 124 | """ |
| 125 | |
| 126 | def doctest_tb_sysexit(): |
| 127 | """ |
| 128 | In [17]: %xmode plain |
| 129 | Exception reporting mode: Plain |
| 130 | |
| 131 | In [18]: %run simpleerr.py exit |
| 132 | An exception has occurred, use %tb to see the full traceback. |
| 133 | SystemExit: (1, 'Mode = exit') |
| 134 | |
| 135 | In [19]: %run simpleerr.py exit 2 |
| 136 | An exception has occurred, use %tb to see the full traceback. |
| 137 | SystemExit: (2, 'Mode = exit') |
| 138 | |
| 139 | In [20]: %tb |
| 140 | Traceback (most recent call last): |
| 141 | File ... in <module> |
| 142 | bar(mode) |
| 143 | File ... line 22, in bar |
| 144 | sysexit(stat, mode) |
| 145 | File ... line 11, in sysexit |
| 146 | raise SystemExit(stat, 'Mode = %s' % mode) |
| 147 | SystemExit: (2, 'Mode = exit') |
| 148 | |
| 149 | In [21]: %xmode context |
| 150 | Exception reporting mode: Context |
| 151 | |
| 152 | In [22]: %tb |
| 153 | --------------------------------------------------------------------------- |
| 154 | SystemExit Traceback (most recent call last) |
| 155 | <BLANKLINE> |
| 156 | ...<module> |
| 157 | 30 mode = 'div' |
| 158 | 31 |
| 159 | ---> 32 bar(mode) |
| 160 | <BLANKLINE> |
| 161 | ...bar(mode) |
| 162 | 20 except: |
| 163 | 21 stat = 1 |
| 164 | ---> 22 sysexit(stat, mode) |
| 165 | 23 else: |
| 166 | 24 raise ValueError('Unknown mode') |
| 167 | <BLANKLINE> |
| 168 | ...sysexit(stat, mode) |
| 169 | 9 |
| 170 | 10 def sysexit(stat, mode): |
| 171 | ---> 11 raise SystemExit(stat, 'Mode = %s' % mode) |
| 172 | 12 |
| 173 | 13 def bar(mode): |
| 174 | <BLANKLINE> |
| 175 | SystemExit: (2, 'Mode = exit') |
| 176 | |
| 177 | In [23]: %xmode verbose |
| 178 | Exception reporting mode: Verbose |
| 179 | |
| 180 | In [24]: %tb |
| 181 | --------------------------------------------------------------------------- |
| 182 | SystemExit Traceback (most recent call last) |
| 183 | <BLANKLINE> |
nothing calls this directly
no outgoing calls
no test coverage detected