Current Path: > > opt > hc_python > lib64 > python3.12 > site-packages > nose > > plugins
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 6291 bytes | April 04 2025 08:02:21. | |
allmodules.py | File | 1720 bytes | April 04 2025 08:02:21. | |
attrib.py | File | 9709 bytes | April 04 2025 08:02:21. | |
base.py | File | 26058 bytes | April 04 2025 08:02:21. | |
builtin.py | File | 1021 bytes | April 04 2025 08:02:21. | |
capture.py | File | 3364 bytes | April 04 2025 08:02:21. | |
collect.py | File | 3156 bytes | April 04 2025 08:02:21. | |
cover.py | File | 11677 bytes | April 04 2025 08:02:21. | |
debug.py | File | 2272 bytes | April 04 2025 08:02:21. | |
deprecated.py | File | 1551 bytes | April 04 2025 08:02:21. | |
doctests.py | File | 17478 bytes | April 04 2025 08:02:21. | |
errorclass.py | File | 7275 bytes | April 04 2025 08:02:21. | |
failuredetail.py | File | 1635 bytes | April 04 2025 08:02:21. | |
isolate.py | File | 3756 bytes | April 04 2025 08:02:21. | |
logcapture.py | File | 9358 bytes | April 04 2025 08:02:21. | |
manager.py | File | 15577 bytes | April 04 2025 08:02:21. | |
multiprocess.py | File | 35286 bytes | April 04 2025 08:02:21. | |
plugintest.py | File | 13533 bytes | April 04 2025 08:02:21. | |
prof.py | File | 5357 bytes | April 04 2025 08:02:21. | |
skip.py | File | 2142 bytes | April 04 2025 08:02:21. | |
testid.py | File | 9917 bytes | April 04 2025 08:02:21. | |
xunit.py | File | 11645 bytes | April 04 2025 08:02:21. |
""" This plugin captures stdout during test execution. If the test fails or raises an error, the captured output will be appended to the error or failure output. It is enabled by default but can be disabled with the options ``-s`` or ``--nocapture``. :Options: ``--nocapture`` Don't capture stdout (any stdout output will be printed immediately) """ import logging import os import sys from nose.plugins.base import Plugin from nose.pyversion import exc_to_unicode, force_unicode from nose.util import ln from io import StringIO log = logging.getLogger(__name__) class Capture(Plugin): """ Output capture plugin. Enabled by default. Disable with ``-s`` or ``--nocapture``. This plugin captures stdout during test execution, appending any output captured to the error or failure output, should the test fail or raise an error. """ enabled = True env_opt = 'NOSE_NOCAPTURE' name = 'capture' score = 1600 def __init__(self): self.stdout = [] self._buf = None def options(self, parser, env): """Register commandline options """ parser.add_option( "-s", "--nocapture", action="store_false", default=not env.get(self.env_opt), dest="capture", help="Don't capture stdout (any stdout output " "will be printed immediately) [NOSE_NOCAPTURE]") def configure(self, options, conf): """Configure plugin. Plugin is enabled by default. """ self.conf = conf if not options.capture: self.enabled = False def afterTest(self, test): """Clear capture buffer. """ self.end() self._buf = None def begin(self): """Replace sys.stdout with capture buffer. """ self.start() # get an early handle on sys.stdout def beforeTest(self, test): """Flush capture buffer. """ self.start() def formatError(self, test, err): """Add captured output to error report. """ test.capturedOutput = output = self.buffer self._buf = None if not output: # Don't return None as that will prevent other # formatters from formatting and remove earlier formatters # formats, instead return the err we got return err ec, ev, tb = err return (ec, self.addCaptureToErr(ev, output), tb) def formatFailure(self, test, err): """Add captured output to failure report. """ return self.formatError(test, err) def addCaptureToErr(self, ev, output): ev = exc_to_unicode(ev) output = force_unicode(output) return '\n'.join([ev, ln('>> begin captured stdout <<'), output, ln('>> end captured stdout <<')]) def start(self): self.stdout.append(sys.stdout) self._buf = StringIO() sys.stdout = self._buf def end(self): if self.stdout: sys.stdout = self.stdout.pop() def finalize(self, result): """Restore stdout. """ while self.stdout: self.end() def _get_buffer(self): if self._buf is not None: return self._buf.getvalue() buffer = property(_get_buffer, None, None, """Captured stdout output.""")
SILENT KILLER Tool