From f926bcccc2492ac50853bb984cbd0d455e50f0b7 Mon Sep 17 00:00:00 2001 From: Delgan Date: Fri, 15 Sep 2017 11:47:08 +0200 Subject: [PATCH] Add automatic hook based on an environment variable --- MANIFEST.in | 10 +++ README.md | 24 +++-- better_exceptions/__init__.py | 47 ++++++---- better_exceptions/__main__.py | 3 +- better_exceptions/{core => }/color.py | 0 better_exceptions/{core => }/context.py | 0 better_exceptions/{core => }/encoding.py | 0 .../{core/__init__.py => formatter.py} | 17 +--- better_exceptions/{core => }/log.py | 2 +- better_exceptions/{core => }/repl.py | 0 better_exceptions_hook.pth | 1 + setup.py | 59 ++++++++++++- test/output/python2-dumb-UTF-8-color.out | 88 ++++++++++--------- test/output/python2-dumb-UTF-8-nocolor.out | 88 ++++++++++--------- test/output/python2-dumb-ascii-color.out | 88 ++++++++++--------- test/output/python2-dumb-ascii-nocolor.out | 88 ++++++++++--------- test/output/python2-vt100-UTF-8-color.out | 88 ++++++++++--------- test/output/python2-vt100-UTF-8-nocolor.out | 88 ++++++++++--------- test/output/python2-vt100-ascii-color.out | 88 ++++++++++--------- test/output/python2-vt100-ascii-nocolor.out | 88 ++++++++++--------- test/output/python2-xterm-UTF-8-color.out | 88 ++++++++++--------- test/output/python2-xterm-UTF-8-nocolor.out | 88 ++++++++++--------- test/output/python2-xterm-ascii-color.out | 88 ++++++++++--------- test/output/python2-xterm-ascii-nocolor.out | 88 ++++++++++--------- test/output/python3-dumb-UTF-8-color.out | 88 ++++++++++--------- test/output/python3-dumb-UTF-8-nocolor.out | 88 ++++++++++--------- test/output/python3-dumb-ascii-color.out | 88 ++++++++++--------- test/output/python3-dumb-ascii-nocolor.out | 88 ++++++++++--------- test/output/python3-vt100-UTF-8-color.out | 88 ++++++++++--------- test/output/python3-vt100-UTF-8-nocolor.out | 88 ++++++++++--------- test/output/python3-vt100-ascii-color.out | 88 ++++++++++--------- test/output/python3-vt100-ascii-nocolor.out | 88 ++++++++++--------- test/output/python3-xterm-UTF-8-color.out | 88 ++++++++++--------- test/output/python3-xterm-UTF-8-nocolor.out | 88 ++++++++++--------- test/output/python3-xterm-ascii-color.out | 88 ++++++++++--------- test/output/python3-xterm-ascii-nocolor.out | 88 ++++++++++--------- test/test.py | 1 + test/test.py.out | 15 ---- test/test_encoding.py | 1 + test/test_logging.py | 1 + test/test_string.sh | 6 +- test/test_truncating.py | 1 + test/test_truncating_disabled.py | 1 + test_all.sh | 2 +- 44 files changed, 1258 insertions(+), 1045 deletions(-) create mode 100644 MANIFEST.in rename better_exceptions/{core => }/color.py (100%) rename better_exceptions/{core => }/context.py (100%) rename better_exceptions/{core => }/encoding.py (100%) rename better_exceptions/{core/__init__.py => formatter.py} (96%) rename better_exceptions/{core => }/log.py (95%) rename better_exceptions/{core => }/repl.py (100%) create mode 100644 better_exceptions_hook.pth delete mode 100644 test/test.py.out diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..880ce3c --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,10 @@ +graft better_exceptions +graft test + +include better_exceptions_hook.pth + +include README.md +include LICENSE.txt +include setup.py +include setup.cfg +include test_all.sh diff --git a/README.md b/README.md index b9b8df3..124348c 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,11 @@ Install `better_exceptions` via pip: $ pip install better_exceptions ``` -And import it somewhere: +And set the `BETTER_EXCEPTIONS` environment variable to any value: -```python -import better_exceptions +```bash +export BETTER_EXCEPTIONS=1 # Linux / OSX +setx BETTER_EXCEPTIONS 1 # Windows ``` That's it! @@ -25,12 +26,25 @@ That's it! If you want to allow the entirety of values to be outputted instead of being truncated to a certain amount of characters: ```python +import better_exceptions better_exceptions.MAX_LENGTH = None ``` -## See Also +While using `better_exceptions` in production, do not forget to unset the `BETTER_EXCEPTIONS` variable to avoid leaking sensitive data in your logs. -- [paradoxxxzero/better-exceptions-hook](https://github.com/paradoxxxzero/better-exceptions-hook) - removes the need to `import better_exceptions` by adding a startup hook +## Troubleshooting + +If you do not see beautiful exceptions, first make sure that the environment variable does exist. You can try `echo $BETTER_EXCEPTIONS` (Linux / OSX) or `echo %BETTER_EXCEPTIONS%` (Windows). On Linux and OSX, the `export` command does not add the variable permanently, you will probably need to edit the `~/.profile` file to make it persistent. On Windows, you need to open a new terminal after the `setx` command. + +You should also note that `better_exceptions` does not work inside the Python interactive shell, unless the executed code comes from another file. + +Check that there is no conflict with another library, and that the `sys.excepthook` function has been correctly replaced with the `better_exceptions`'s one. Sometimes other components can set up their own exception handlers, such as the `python3-apport` Ubuntu package that you may need to uninstall. + +Make sure that you have not inadvertently deleted the `better_exceptions_hook.pth` file that should be in the same place as the `better_exceptions` folder where all of your Python packages are installed. Otherwise, try re-installing `better_exceptions`. + +You can also try to manually activate the hook by adding `import better_exceptions; better_exceptions.hook()` at the beginning of your script. + +Finally, if you still can not get this module to work, [open a new issue](https://github.com/Qix-/better-exceptions/issues/new) by describing your problem precisely and detailing your configuration (Python and `better_exceptions` versions, OS, code snippet, interpeter, etc.) so that we can reproduce the bug you are experiencing. # License Copyright © 2017, Josh Junon. Licensed under the [MIT license](LICENSE.txt). diff --git a/better_exceptions/__init__.py b/better_exceptions/__init__.py index d183f84..c736563 100644 --- a/better_exceptions/__init__.py +++ b/better_exceptions/__init__.py @@ -1,6 +1,6 @@ """Beautiful and helpful exceptions -Just `import better_exceptions` somewhere. It handles the rest. +Just set your `BETTER_EXCEPTIONS` environment variable. It handles the rest. Name: better_exceptions @@ -16,16 +16,32 @@ from __future__ import print_function import logging import sys -from .core import color, context, encoding, log, repl -from .core import SUPPORTS_COLOR, THEME, MAX_LENGTH, PIPE_CHAR, CAP_CHAR -from .core import __version__, isast, write_stream, ExceptionFormatter -from .core.log import BetExcLogger, patch as patch_logging -from .core.repl import interact, get_repl +from .formatter import THEME, MAX_LENGTH, PIPE_CHAR, CAP_CHAR, ExceptionFormatter +from .encoding import to_byte +from .context import PY3 +from .color import SUPPORTS_COLOR, SHOULD_ENCODE, STREAM +from .log import BetExcLogger, patch as patch_logging +from .repl import interact, get_repl + + +__version__ = '0.1.8' THEME = THEME.copy() # Users customizing the theme should not impact core +def write_stream(data, stream=STREAM): + if SHOULD_ENCODE: + data = to_byte(data) + + if PY3: + stream.buffer.write(data) + else: + stream.write(data) + else: + stream.write(data) + + def format_exception(exc, value, tb): # Rebuild each time to take into account any changes made by the user to the global parameters formatter = ExceptionFormatter(colored=SUPPORTS_COLOR, theme=THEME, max_length=MAX_LENGTH, @@ -35,17 +51,16 @@ def format_exception(exc, value, tb): def excepthook(exc, value, tb): formatted = format_exception(exc, value, tb) - write_stream(formatted) + write_stream(formatted, STREAM) -sys.excepthook = excepthook +def hook(): + sys.excepthook = excepthook + logging.setLoggerClass(BetExcLogger) + patch_logging() -logging.setLoggerClass(BetExcLogger) -patch_logging() - - -if hasattr(sys, 'ps1'): - print('WARNING: better_exceptions will only inspect code from the command line\n' - ' when using: `python -m better_exceptions\'. Otherwise, only code\n' - ' loaded from files will be inspected!', file=sys.stderr) + if hasattr(sys, 'ps1'): + print('WARNING: better_exceptions will only inspect code from the command line\n' + ' when using: `python -m better_exceptions\'. Otherwise, only code\n' + ' loaded from files will be inspected!', file=sys.stderr) diff --git a/better_exceptions/__main__.py b/better_exceptions/__main__.py index 0febbf0..88e2934 100644 --- a/better_exceptions/__main__.py +++ b/better_exceptions/__main__.py @@ -2,7 +2,8 @@ import argparse import imp import os -from better_exceptions import interact +from better_exceptions import interact, hook +hook() parser = argparse.ArgumentParser(description='A Python REPL with better exceptions enabled', prog='python -m better_exceptions') parser.add_argument('-q', '--quiet', help="don't show a banner", action='store_true') diff --git a/better_exceptions/core/color.py b/better_exceptions/color.py similarity index 100% rename from better_exceptions/core/color.py rename to better_exceptions/color.py diff --git a/better_exceptions/core/context.py b/better_exceptions/context.py similarity index 100% rename from better_exceptions/core/context.py rename to better_exceptions/context.py diff --git a/better_exceptions/core/encoding.py b/better_exceptions/encoding.py similarity index 100% rename from better_exceptions/core/encoding.py rename to better_exceptions/encoding.py diff --git a/better_exceptions/core/__init__.py b/better_exceptions/formatter.py similarity index 96% rename from better_exceptions/core/__init__.py rename to better_exceptions/formatter.py index 16a66c6..ac4ee42 100644 --- a/better_exceptions/core/__init__.py +++ b/better_exceptions/formatter.py @@ -21,15 +21,12 @@ import re import sys import traceback -from .color import STREAM, SUPPORTS_COLOR, SHOULD_ENCODE +from .color import STREAM, SUPPORTS_COLOR from .context import PY3 from .encoding import ENCODING, to_byte, to_unicode from .repl import get_repl -__version__ = '0.1.8' - - PIPE_CHAR = u'\u2502' CAP_CHAR = u'\u2514' @@ -54,18 +51,6 @@ def isast(v): return inspect.isclass(v) and issubclass(v, ast.AST) -def write_stream(data, stream=STREAM): - if SHOULD_ENCODE: - data = to_byte(data) - - if PY3: - stream.buffer.write(data) - else: - stream.write(data) - else: - stream.write(data) - - class ExceptionFormatter(object): COMMENT_REGXP = re.compile(r'((?:(?:"(?:[^\\"]|(\\\\)*\\")*")|(?:\'(?:[^\\"]|(\\\\)*\\\')*\')|[^#])*)(#.*)$') diff --git a/better_exceptions/core/log.py b/better_exceptions/log.py similarity index 95% rename from better_exceptions/core/log.py rename to better_exceptions/log.py index 4c9f619..0f4b2ec 100644 --- a/better_exceptions/core/log.py +++ b/better_exceptions/log.py @@ -7,7 +7,7 @@ from logging import Logger, StreamHandler def patch(): import logging - from .. import format_exception + from . import format_exception logging_format_exception = lambda exc_info: format_exception(*exc_info) diff --git a/better_exceptions/core/repl.py b/better_exceptions/repl.py similarity index 100% rename from better_exceptions/core/repl.py rename to better_exceptions/repl.py diff --git a/better_exceptions_hook.pth b/better_exceptions_hook.pth new file mode 100644 index 0000000..418280d --- /dev/null +++ b/better_exceptions_hook.pth @@ -0,0 +1 @@ +import os; exec("try:\n if 'BETTER_EXCEPTIONS' in os.environ:import better_exceptions;better_exceptions.hook()\nexcept:print('An error occured while automatically hooking better_exceptions.\\nIf you uninstalled better_exceptions, you should probably delete any \\'better_exceptions_hook.pth\\' file on your system or unset your \\'BETTER_EXCEPTIONS\\' environment variable.'); raise;") diff --git a/setup.py b/setup.py index ce80c71..b71c7d4 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,59 @@ import re +from itertools import chain +from os.path import basename +from os.path import dirname +from os.path import join +from os.path import splitext from distutils.core import setup +from distutils.command.build import build +from setuptools.command.develop import develop +from setuptools.command.easy_install import easy_install +from setuptools.command.install_lib import install_lib -with open('better_exceptions/core/__init__.py', 'r') as file: + +class BuildWithPTH(build): + def run(self): + build.run(self) + path = join(dirname(__file__), 'better_exceptions_hook.pth') + dest = join(self.build_lib, basename(path)) + self.copy_file(path, dest) + + +class EasyInstallWithPTH(easy_install): + def run(self): + easy_install.run(self) + path = join(dirname(__file__), 'better_exceptions_hook.pth') + dest = join(self.install_dir, basename(path)) + self.copy_file(path, dest) + + +class InstallLibWithPTH(install_lib): + def run(self): + install_lib.run(self) + path = join(dirname(__file__), 'better_exceptions_hook.pth') + dest = join(self.install_dir, basename(path)) + self.copy_file(path, dest) + self.outputs = [dest] + + def get_outputs(self): + return chain(install_lib.get_outputs(self), self.outputs) + + +class DevelopWithPTH(develop): + def run(self): + develop.run(self) + path = join(dirname(__file__), 'better_exceptions_hook.pth') + dest = join(self.install_dir, basename(path)) + self.copy_file(path, dest) + + +with open('better_exceptions/__init__.py', 'r') as file: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', file.read(), re.MULTILINE).group(1) setup( name = 'better_exceptions', - packages = ['better_exceptions', 'better_exceptions.core', 'better_exceptions_core'], - package_dir = {'better_exceptions_core': 'better_exceptions/core'}, + packages = ['better_exceptions'], version = version, description = 'Pretty and helpful exceptions, automatically', author = 'Josh Junon', @@ -19,5 +64,13 @@ setup( classifiers = [], extras_require = { ':sys_platform=="win32"': ['colorama'] + }, + # This all comes from pytest-cov repository: + # https://github.com/pytest-dev/pytest-cov/blob/cde7c378b6a1971957759f42ac91e2860b41cf89/setup.py + cmdclass = { + 'build': BuildWithPTH, + 'easy_install': EasyInstallWithPTH, + 'install_lib': InstallLibWithPTH, + 'develop': DevelopWithPTH, } ) diff --git a/test/output/python2-dumb-UTF-8-color.out b/test/output/python2-dumb-UTF-8-color.out index 2b3baed..b110465 100644 --- a/test/output/python2-dumb-UTF-8-color.out +++ b/test/output/python2-dumb-UTF-8-color.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  │ └ 52  └ 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  └  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  └ 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-dumb-UTF-8-nocolor.out b/test/output/python2-dumb-UTF-8-nocolor.out index 04035ea..3b65dd6 100644 --- a/test/output/python2-dumb-UTF-8-nocolor.out +++ b/test/output/python2-dumb-UTF-8-nocolor.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └ - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └ - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 │ └ 52 └ 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └ - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") └ - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 └ 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └ - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-dumb-ascii-color.out b/test/output/python2-dumb-ascii-color.out index 4a49bbe..c7b6c96 100644 --- a/test/output/python2-dumb-ascii-color.out +++ b/test/output/python2-dumb-ascii-color.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 ->  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 ->  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  | -> 52  -> 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() ->  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  ->  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  -> 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -166,10 +172,10 @@ python2 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() ->  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-dumb-ascii-nocolor.out b/test/output/python2-dumb-ascii-nocolor.out index 9caeba8..9df8079 100644 --- a/test/output/python2-dumb-ascii-nocolor.out +++ b/test/output/python2-dumb-ascii-nocolor.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 -> - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 -> - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 | -> 52 -> 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() -> - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") -> - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 -> 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -166,10 +172,10 @@ python2 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() -> - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-vt100-UTF-8-color.out b/test/output/python2-vt100-UTF-8-color.out index 2b3baed..b110465 100644 --- a/test/output/python2-vt100-UTF-8-color.out +++ b/test/output/python2-vt100-UTF-8-color.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  │ └ 52  └ 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  └  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  └ 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-vt100-UTF-8-nocolor.out b/test/output/python2-vt100-UTF-8-nocolor.out index 892ff04..66ae1be 100644 --- a/test/output/python2-vt100-UTF-8-nocolor.out +++ b/test/output/python2-vt100-UTF-8-nocolor.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └ - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └ - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 │ └ 52 └ 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └ - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") └ - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 └ 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └ - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-vt100-ascii-color.out b/test/output/python2-vt100-ascii-color.out index 4a49bbe..c7b6c96 100644 --- a/test/output/python2-vt100-ascii-color.out +++ b/test/output/python2-vt100-ascii-color.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 ->  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 ->  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  | -> 52  -> 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() ->  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  ->  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  -> 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -166,10 +172,10 @@ python2 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() ->  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-vt100-ascii-nocolor.out b/test/output/python2-vt100-ascii-nocolor.out index a2388cb..2318d3c 100644 --- a/test/output/python2-vt100-ascii-nocolor.out +++ b/test/output/python2-vt100-ascii-nocolor.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 -> - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 -> - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 | -> 52 -> 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() -> - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") -> - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 -> 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -166,10 +172,10 @@ python2 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() -> - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-xterm-UTF-8-color.out b/test/output/python2-xterm-UTF-8-color.out index 2b3baed..b110465 100644 --- a/test/output/python2-xterm-UTF-8-color.out +++ b/test/output/python2-xterm-UTF-8-color.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  │ └ 52  └ 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  └  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  └ 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-xterm-UTF-8-nocolor.out b/test/output/python2-xterm-UTF-8-nocolor.out index 892ff04..66ae1be 100644 --- a/test/output/python2-xterm-UTF-8-nocolor.out +++ b/test/output/python2-xterm-UTF-8-nocolor.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └ - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └ - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 │ └ 52 └ 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └ - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") └ - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 └ 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └ - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-xterm-ascii-color.out b/test/output/python2-xterm-ascii-color.out index 4a49bbe..c7b6c96 100644 --- a/test/output/python2-xterm-ascii-color.out +++ b/test/output/python2-xterm-ascii-color.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 ->  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 ->  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  | -> 52  -> 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() ->  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  ->  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  -> 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -166,10 +172,10 @@ python2 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() ->  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python2-xterm-ascii-nocolor.out b/test/output/python2-xterm-ascii-nocolor.out index a2388cb..2318d3c 100644 --- a/test/output/python2-xterm-ascii-nocolor.out +++ b/test/output/python2-xterm-ascii-nocolor.out @@ -2,16 +2,16 @@ python2 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 -> - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 -> - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 | -> 52 -> 17 @@ -30,13 +30,13 @@ python2 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() -> - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") -> - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -69,56 +69,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -128,19 +134,19 @@ python2 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 -> 52 AssertionError: assert baz == 90 @@ -152,10 +158,10 @@ python2 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -166,10 +172,10 @@ python2 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() -> - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-dumb-UTF-8-color.out b/test/output/python3-dumb-UTF-8-color.out index 616986a..bff7a54 100644 --- a/test/output/python3-dumb-UTF-8-color.out +++ b/test/output/python3-dumb-UTF-8-color.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  │ └ 52  └ 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  └  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  └ 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-dumb-UTF-8-nocolor.out b/test/output/python3-dumb-UTF-8-nocolor.out index 0c16e88..32c26fb 100644 --- a/test/output/python3-dumb-UTF-8-nocolor.out +++ b/test/output/python3-dumb-UTF-8-nocolor.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └ - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └ - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 │ └ 52 └ 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └ - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") └ - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 └ 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └ - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-dumb-ascii-color.out b/test/output/python3-dumb-ascii-color.out index 9462f62..0363a6d 100644 --- a/test/output/python3-dumb-ascii-color.out +++ b/test/output/python3-dumb-ascii-color.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 ->  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 ->  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  | -> 52  -> 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() ->  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  ->  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  -> 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -165,10 +171,10 @@ python3 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() ->  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-dumb-ascii-nocolor.out b/test/output/python3-dumb-ascii-nocolor.out index 2404ac0..76270e0 100644 --- a/test/output/python3-dumb-ascii-nocolor.out +++ b/test/output/python3-dumb-ascii-nocolor.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 -> - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 -> - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 | -> 52 -> 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() -> - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") -> - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 -> 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -165,10 +171,10 @@ python3 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() -> - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-vt100-UTF-8-color.out b/test/output/python3-vt100-UTF-8-color.out index 616986a..bff7a54 100644 --- a/test/output/python3-vt100-UTF-8-color.out +++ b/test/output/python3-vt100-UTF-8-color.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  │ └ 52  └ 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  └  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  └ 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-vt100-UTF-8-nocolor.out b/test/output/python3-vt100-UTF-8-nocolor.out index 5bea5b2..487509c 100644 --- a/test/output/python3-vt100-UTF-8-nocolor.out +++ b/test/output/python3-vt100-UTF-8-nocolor.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └ - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └ - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 │ └ 52 └ 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └ - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") └ - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 └ 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └ - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-vt100-ascii-color.out b/test/output/python3-vt100-ascii-color.out index 9462f62..0363a6d 100644 --- a/test/output/python3-vt100-ascii-color.out +++ b/test/output/python3-vt100-ascii-color.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 ->  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 ->  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  | -> 52  -> 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() ->  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  ->  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  -> 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -165,10 +171,10 @@ python3 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() ->  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-vt100-ascii-nocolor.out b/test/output/python3-vt100-ascii-nocolor.out index 6b56c89..8538625 100644 --- a/test/output/python3-vt100-ascii-nocolor.out +++ b/test/output/python3-vt100-ascii-nocolor.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 -> - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 -> - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 | -> 52 -> 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() -> - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") -> - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 -> 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -165,10 +171,10 @@ python3 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() -> - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-xterm-UTF-8-color.out b/test/output/python3-xterm-UTF-8-color.out index 616986a..bff7a54 100644 --- a/test/output/python3-xterm-UTF-8-color.out +++ b/test/output/python3-xterm-UTF-8-color.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  │ └ 52  └ 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  └  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  │ └ 5 -  └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  │ │ └ 5 +  │ └ 5 +  └  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  │ └ 'why hello there' -  └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  │ │ └ 'why hello there' +  │ └ 'why hello there' +  └  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  └ 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-xterm-UTF-8-nocolor.out b/test/output/python3-xterm-UTF-8-nocolor.out index 5bea5b2..487509c 100644 --- a/test/output/python3-xterm-UTF-8-nocolor.out +++ b/test/output/python3-xterm-UTF-8-nocolor.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) │ └ 2 └ - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) │ │ └ 15 │ └ 2 └ - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 │ └ 52 └ 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() └ - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") └ - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val └ '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - │ └ 5 - └ 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + │ │ └ 5 + │ └ 5 + └ +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - │ └ 'why hello there' - └ 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + │ │ └ 'why hello there' + │ └ 'why hello there' + └ +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() └ - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 └ 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() └ + File "test/test_truncating_disabled.py", line 12, in div() └ - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-xterm-ascii-color.out b/test/output/python3-xterm-ascii-color.out index 9462f62..0363a6d 100644 --- a/test/output/python3-xterm-ascii-color.out +++ b/test/output/python3-xterm-ascii-color.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 ->  - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 ->  - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60  | -> 52  -> 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() ->  - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep('天')  ->  - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val  -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine -  | -> 5 -  -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine +  | | -> 5 +  | -> 5 +  ->  +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello there'; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False -  | -> 'why hello there' -  -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = 'why hello ' + ' there'; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False +  | | -> 'why hello there' +  | -> 'why hello there' +  ->  +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = 'why hello ' + ' there'; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() ->  - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90  -> 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -165,10 +171,10 @@ python3 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() ->  - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var  -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/output/python3-xterm-ascii-nocolor.out b/test/output/python3-xterm-ascii-nocolor.out index 6b56c89..8538625 100644 --- a/test/output/python3-xterm-ascii-nocolor.out +++ b/test/output/python3-xterm-ascii-nocolor.out @@ -2,16 +2,16 @@ python3 test/test.py Traceback (most recent call last): - File "test/test.py", line 16, in + File "test/test.py", line 17, in shallow(bar, 15) | -> 2 -> - File "test/test.py", line 7, in shallow + File "test/test.py", line 8, in shallow deep(a + b) | | -> 15 | -> 2 -> - File "test/test.py", line 12, in deep + File "test/test.py", line 13, in deep assert val > 10 and foo == 60 | -> 52 -> 17 @@ -30,13 +30,13 @@ python3 test/test_encoding.py Traceback (most recent call last): - File "test/test_encoding.py", line 13, in + File "test/test_encoding.py", line 14, in div() -> - File "test/test_encoding.py", line 10, in div + File "test/test_encoding.py", line 11, in div return _deep("天") -> - File "test/test_encoding.py", line 7, in _deep + File "test/test_encoding.py", line 8, in _deep return 1 / val -> '天' TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -68,56 +68,62 @@ AssertionError: assert a > 10 -import better_exceptions; a = 5; assert a > 10 # this should work fine +import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine Traceback (most recent call last): File "", line 1, in - import better_exceptions; a = 5; assert a > 10 # this should work fine - | -> 5 - -> 5 -AssertionError: import better_exceptions; a = 5; assert a > 10 # this should work fine + import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine + | | -> 5 + | -> 5 + -> +AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine -from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False why hello there -from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False +from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there Traceback (most recent call last): File "", line 1, in - from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False - | -> 'why hello there' - -> 'why hello there' -AssertionError: from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False + from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False + | | -> 'why hello there' + | -> 'why hello there' + -> +AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False why hello there @@ -127,19 +133,19 @@ python3 test/test_logging.py ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 32, in bar3 + File "test/test_logging.py", line 33, in bar3 raise Exception('this is a test exception') Exception: this is a test exception ERROR:__main__:callback failed Traceback (most recent call last): - File "test/test_logging.py", line 15, in foo + File "test/test_logging.py", line 16, in foo cb() -> - File "test/test_logging.py", line 37, in bar4 + File "test/test_logging.py", line 38, in bar4 assert baz == 90 -> 52 AssertionError: assert baz == 90 @@ -151,10 +157,10 @@ python3 test/test_truncating.py Traceback (most recent call last): - File "test/test_truncating.py", line 11, in + File "test/test_truncating.py", line 12, in div() -> '999999999... TypeError: unsupported operand type(s) for /: 'int' and 'str' @@ -165,10 +171,10 @@ python3 test/test_truncating_disabled.py Traceback (most recent call last): - File "test/test_truncating_disabled.py", line 11, in + File "test/test_truncating_disabled.py", line 12, in div() -> - File "test/test_truncating_disabled.py", line 8, in div + File "test/test_truncating_disabled.py", line 9, in div return 1 / var -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' TypeError: unsupported operand type(s) for /: 'int' and 'str' diff --git a/test/test.py b/test/test.py index 56f011b..23b0120 100644 --- a/test/test.py +++ b/test/test.py @@ -1,4 +1,5 @@ import better_exceptions +better_exceptions.hook() foo = 52 diff --git a/test/test.py.out b/test/test.py.out deleted file mode 100644 index fbee076..0000000 --- a/test/test.py.out +++ /dev/null @@ -1,15 +0,0 @@ -Traceback (most recent call last): - File "test/test.py", line 16, in - shallow(bar, 15) - │ └ 2 - └  - File "test/test.py", line 7, in shallow - deep(a + b) - │ │ └ 15 - │ └ 2 - └  - File "test/test.py", line 12, in deep - assert val > 10 and foo == 60 -  │ └ 52 -  └ 17 -AssertionError: assert val > 10 and foo == 60 diff --git a/test/test_encoding.py b/test/test_encoding.py index 5a9c26b..d9e951f 100644 --- a/test/test_encoding.py +++ b/test/test_encoding.py @@ -1,6 +1,7 @@ # -*- coding:utf-8 -*- import better_exceptions +better_exceptions.hook() def _deep(val): diff --git a/test/test_logging.py b/test/test_logging.py index 1d5661f..8bf4019 100644 --- a/test/test_logging.py +++ b/test/test_logging.py @@ -1,6 +1,7 @@ import better_exceptions import logging +better_exceptions.hook() logging.basicConfig() logger = logging.getLogger(__name__) diff --git a/test/test_string.sh b/test/test_string.sh index a77a82a..7dc4a8c 100755 --- a/test/test_string.sh +++ b/test/test_string.sh @@ -17,6 +17,6 @@ function test_str { "${BETEXC_PYTHON}" -c"$cmd" "${@}" || true } -test_str 'import better_exceptions; a = 5; assert a > 10 # this should work fine' these extra arguments should be removed and should not show up 'in' the output -test_str 'from __future__ import print_function; import better_exceptions; a = "why hello there"; print(a); assert False' -test_str 'from __future__ import print_function; import better_exceptions; a = "why hello " + " there"; print(a); assert False' +test_str 'import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine' these extra arguments should be removed and should not show up 'in' the output +test_str 'from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False' +test_str 'from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False' diff --git a/test/test_truncating.py b/test/test_truncating.py index bcad0b0..3abf646 100644 --- a/test/test_truncating.py +++ b/test/test_truncating.py @@ -1,6 +1,7 @@ # -*- coding:utf-8 -*- import better_exceptions +better_exceptions.hook() better_exceptions.MAX_LENGTH = 10 def div(): diff --git a/test/test_truncating_disabled.py b/test/test_truncating_disabled.py index 93593a3..4d193b8 100644 --- a/test/test_truncating_disabled.py +++ b/test/test_truncating_disabled.py @@ -1,6 +1,7 @@ # -*- coding:utf-8 -*- import better_exceptions +better_exceptions.hook() better_exceptions.MAX_LENGTH = None def div(): diff --git a/test_all.sh b/test_all.sh index 9fc32e2..378f517 100755 --- a/test_all.sh +++ b/test_all.sh @@ -17,7 +17,7 @@ export PYTHONPATH function normalize { # we translate anything that looks like an address into 0xDEADBEEF # since the addresses change from run to run and break diff testing - cat | sed 's|0x[a-fA-F0-9]\{1,\}|0xDEADBEEF|g' | sed 's|File "/[^"]*"|File "/removed/for/test/purposes.ext"|g' | grep -v "bash: warning:" + cat | sed 's|0x[a-fA-F0-9]\{1,\}|0xDEADBEEF|g' | sed 's||"'|g' | sed 's|File "/[^"]*"|File "/removed/for/test/purposes.ext"|g' | grep -v "bash: warning:" } function test_case {