Skip to main content

nose_traceback_info

Have you ever wanted supplemental (debugging) info included in an error or failure traceback produced by nose? Do you find that nose’s Failure Detail plugin fails you (for example, because you use PyHamcrest matchers)? Developing server software using Zope, Plone, Paste or WebError? Then this plugin might be the solution you’re looking for: it allows you to add whatever detailed information you want to any frame in your traceback. Turn a traceback like this:

Traceback (most recent call last):
File "/.../nti.nose_traceback_info/src/nti/nose_traceback_info/tests/test_nose_traceback_info.py", line 39, in test_format_failure
  t, formatted, _ = self.plugin.formatFailure(None, exc_info)
File "/.../nti.nose_traceback_info/src/nti/nose_traceback_info/__init__.py", line 48, in formatFailure
  return self.formatError( test, exc_info)
File "/.../nti.nose_traceback_info/src/nti/nose_traceback_info/__init__.py", line 31, in formatError
  t, v, tb = exc_info
TypeError: 'builtin_function_or_method' object is not iterable

into a traceback like this:

TypeError: Traceback (most recent call last):
Module unittest.case, line 331, in run
  testMethod()
Module nti.nose_traceback_info.tests.test_nose_traceback_info, line 39, in test_format_failure
  t, formatted, _ = self.plugin.formatFailure(None, exc_info)
  - __traceback_info__: ("calling plugin with test and exc_info", None, <build-in function exc_info>)
Module nti.nose_traceback_info, line 48, in formatFailure
  return self.formatError( test, exc_info)
Module nti.nose_traceback_info, line 31, in formatError
  t, v, tb = exc_info
  - __traceback_info__: ("Test and exc_info args", None, <built-in function exc_info>)
TypeError: 'builtin_function_or_method' object is not iterable

Usage

Once the plugin is installed (using pip or in a setup.py or requirements.txt file), it is enabled by default, just like logcapture. The plugin operates by looking for local variables in each frame in a traceback and formatting them (both in captured logs and tracebacks displayed for failured tests). The variables are defined by conventions developed (and documented) by Zope; these conventions are also followed by Paste and WebError, meaning that information added to help debug tests can also be used to debug production errors.

See that documentation for details on the variables. As a quick start, the most important and most commonly used variable is __traceback_info__, to which you can assign arbitrary information. The repr of __traceback_info__ is included in the traceback:

def formatError(self, test, exc_info):
    __traceback_info__ = "Test and exc_info args", test, exc_info
    t, v, tb = exc_info

Options

In addition to the standard environment variable and flags to enable the plugin, additional options control some behaviour.

--traceback-long-filenames

Use complete filenames, not module names, in formatted tracebacks.

--traceback-nologcapture

Do not format tracebacks captured in logs.

Other Plugins

This plugin is known to cooperate correctly with nose-progressive, which also adjusts the traceback.

Changes

1.0.2 (2015-04-21)

  • Add support for PyPy, Python 3.4 and Python 3.2.

1.0.1 (2013-12-14)

  • By default, show filenames instead of module names. This cooperates better with IDE test integration.

1.0.0 (2013-09-27)

Initial release

Release files for nti.nose_traceback_info 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nti.nose_traceback_info 1.0.2
File Size Uploaded
nti.nose_traceback_info-1.0.2.tar.gz 6.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for nti.nose_traceback_info 1.0.2
File Interpreter ABI Platform
nti.nose_traceback_info-1.0.2-py3.4.egg Legacy Egg format - - Details
nti.nose_traceback_info-1.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details
nti.nose_traceback_info-1.0.2-py2.7.egg Legacy Egg format - - Details

Total release size: 37.4 kB

Release files / nti.nose_traceback_info-1.0.2.tar.gz

Download URL nti.nose_traceback_info-1.0.2.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7b90cf0117be9495367e287b2fe2744a895352c7548832fb42cac002b9fb6e9e
BLAKE2b-256 checksum
How to use checksums
27f3e00c7e87cc83b9efd8f3cd269aa4d39e25bf6924143187b34b2e0c667899
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nti.nose_traceback_info-1.0.2-py3.4.egg

Download URL nti.nose_traceback_info-1.0.2-py3.4.egg
Size 10.9 kB
Tags Egg
SHA-256 checksum
How to use checksums
e5c2c7be596c984b00833641693234c1e9a9daede1fc66e9725c89a09714a58c
BLAKE2b-256 checksum
How to use checksums
81f0c18a3a47337cf335dbfbc6e90d221eb23c04c05cd3c0756153918a81f5d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nti.nose_traceback_info-1.0.2-py2.py3-none-any.whl

Download URL nti.nose_traceback_info-1.0.2-py2.py3-none-any.whl
Size 9.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b8789cd4847a09dcddc74688ea1b2fb8f862e220b50d160909de1deb2738933a
BLAKE2b-256 checksum
How to use checksums
bf12d7f2a6682b5a0cedfb9cc20e4cf6982fdc6ce675318cf4675e889bb1fff9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nti.nose_traceback_info-1.0.2-py2.7.egg

Download URL nti.nose_traceback_info-1.0.2-py2.7.egg
Size 10.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
f9703414c1029de683accf70d9371d3ead46a44ad5d8302db30e251b15ff58d3
BLAKE2b-256 checksum
How to use checksums
30fdd289ec17c5b1cc1b68d636bbd2c183e7bcd7d32bf24cdbb8683e1e9a6c8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.2 This release

4 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page