PHP 8.2.30
Preview: failuredetail.py Size: 1.60 KB
/opt/hc_python/lib/python3.12/site-packages/nose/plugins/failuredetail.py

"""
This plugin provides assert introspection. When the plugin is enabled
and a test failure occurs, the traceback is displayed with extra context
around the line in which the exception was raised. Simple variable 
substitution is also performed in the context output to provide more
debugging information.
"""
    
from nose.plugins import Plugin
from nose.pyversion import exc_to_unicode, force_unicode
from nose.inspector import inspect_traceback

class FailureDetail(Plugin):
    """
    Plugin that provides extra information in tracebacks of test failures.
    """
    score = 1600 # before capture
    
    def options(self, parser, env):
        """Register commmandline options.
        """
        parser.add_option(
            "-d", "--detailed-errors", "--failure-detail",
            action="store_true",
            default=env.get('NOSE_DETAILED_ERRORS'),
            dest="detailedErrors", help="Add detail to error"
            " output by attempting to evaluate failed"
            " asserts [NOSE_DETAILED_ERRORS]")

    def configure(self, options, conf):
        """Configure plugin.
        """
        if not self.can_configure:
            return
        self.enabled = options.detailedErrors
        self.conf = conf

    def formatFailure(self, test, err):
        """Add detail from traceback inspection to error message of a failure.
        """
        ec, ev, tb = err
        tbinfo, str_ev = None, exc_to_unicode(ev)

        if tb:
            tbinfo = force_unicode(inspect_traceback(tb))
            str_ev = '\n'.join([str_ev, tbinfo])
        test.tbinfo = tbinfo
        return (ec, str_ev, tb)

Directory Contents

Dirs: 1 × Files: 22

Name Size Perms Modified Actions
- drwxr-xr-x 2025-04-04 08:01:56
Edit Download
1.68 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
9.48 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
25.45 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
1021 B lrw-r--r-- 2025-04-04 08:01:56
Edit Download
3.29 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
3.08 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
11.40 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
2.22 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
1.51 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
17.07 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
7.10 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
1.60 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
3.67 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
9.14 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
15.21 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
34.46 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
13.22 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
5.23 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
2.09 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
9.68 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
11.37 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download
6.14 KB lrw-r--r-- 2025-04-04 08:01:56
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).