/
usr
/
lib
/
python2.6
/
site-packages
/
nose
/
plugins
/
/usr/lib/python2.6/site-packages/nose/plugins
mkdir
upload
Name
Size
Mode
Actions
attrib.py
7810
0644
edit
dl
rm
attrib.pyc
7428
0644
edit
dl
rm
attrib.pyo
7428
0644
edit
dl
rm
base.py
31384
0644
edit
dl
rm
base.pyc
36810
0644
edit
dl
rm
base.pyo
36810
0644
edit
dl
rm
builtin.py
792
0644
edit
dl
rm
builtin.pyc
1369
0644
edit
dl
rm
builtin.pyo
1369
0644
edit
dl
rm
capture.py
2780
0644
edit
dl
rm
capture.pyc
4565
0644
edit
dl
rm
capture.pyo
4565
0644
edit
dl
rm
cover.py
6416
0644
edit
dl
rm
cover.pyc
6213
0644
edit
dl
rm
cover.pyo
6213
0644
edit
dl
rm
debug.py
1679
0644
edit
dl
rm
debug.pyc
2481
0644
edit
dl
rm
debug.pyo
2481
0644
edit
dl
rm
deprecated.py
1639
0644
edit
dl
rm
deprecated.pyc
2385
0644
edit
dl
rm
deprecated.pyo
2385
0644
edit
dl
rm
doctests.py
9147
0644
edit
dl
rm
doctests.pyc
9891
0644
edit
dl
rm
doctests.pyo
9891
0644
edit
dl
rm
errorclass.py
6438
0644
edit
dl
rm
errorclass.pyc
8037
0644
edit
dl
rm
errorclass.pyo
8037
0644
edit
dl
rm
failuredetail.py
1564
0644
edit
dl
rm
failuredetail.pyc
2334
0644
edit
dl
rm
failuredetail.pyo
2334
0644
edit
dl
rm
isolate.py
3674
0644
edit
dl
rm
isolate.pyc
4729
0644
edit
dl
rm
isolate.pyo
4729
0644
edit
dl
rm
manager.py
14330
0644
edit
dl
rm
manager.pyc
18370
0644
edit
dl
rm
manager.pyo
18370
0644
edit
dl
rm
plugintest.py
7994
0644
edit
dl
rm
plugintest.pyc
9644
0644
edit
dl
rm
plugintest.pyo
9644
0644
edit
dl
rm
prof.py
4744
0644
edit
dl
rm
prof.pyc
4933
0644
edit
dl
rm
prof.pyo
4933
0644
edit
dl
rm
skip.py
1572
0644
edit
dl
rm
skip.pyc
2289
0644
edit
dl
rm
skip.pyo
2289
0644
edit
dl
rm
testid.py
4871
0644
edit
dl
rm
testid.pyc
5479
0644
edit
dl
rm
testid.pyo
5479
0644
edit
dl
rm
__init__.py
8169
0644
edit
dl
rm
__init__.pyc
8412
0644
edit
dl
rm
__init__.pyo
8412
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/site-packages/nose/plugins/capture.py
(2780B)
""" 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. It is enabled by default but may be disable with the options -s or --nocapture. """ import logging import os import sys from nose.plugins.base import Plugin from nose.util import ln try: from cStringIO import StringIO except ImportError: from StringIO 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 = 500 def __init__(self): self.stdout = [] self._buf = None def options(self, parser, env=os.environ): 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): self.conf = conf if not options.capture: self.enabled = False def afterTest(self, test): self.end() self._buf = None def begin(self): self.start() # get an early handle on sys.stdout def beforeTest(self, test): self.start() def formatError(self, test, err): 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): return self.formatError(test, err) def addCaptureToErr(self, ev, output): return '\n'.join([str(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): 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.""")
Save
cmd:
run