Created
December 14, 2011 18:40
-
-
Save jpellerin/1477878 to your computer and use it in GitHub Desktop.
issue #6/#290 patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r fda1e996260d nose/ext/dtcompat.py | |
--- a/nose/ext/dtcompat.py Tue May 05 19:22:53 2009 -0400 | |
+++ b/nose/ext/dtcompat.py Mon Sep 07 17:25:13 2009 -0700 | |
@@ -247,6 +247,8 @@ | |
# Override some StringIO methods. | |
class _SpoofOut(StringIO): | |
+ fileno = lambda self : 1 | |
+ | |
def getvalue(self): | |
result = StringIO.getvalue(self) | |
# If anything at all was written, make sure there's a trailing | |
@@ -1925,6 +1927,8 @@ | |
_unittest_reportflags = flags | |
return old | |
+class Buffer(StringIO): | |
+ fileno = lambda self : 1 | |
class DocTestCase(unittest.TestCase): | |
@@ -1955,7 +1959,7 @@ | |
def runTest(self): | |
test = self._dt_test | |
old = sys.stdout | |
- new = StringIO() | |
+ new = Buffer() | |
optionflags = self._dt_optionflags | |
if not (optionflags & REPORTING_FLAGS): | |
diff -r fda1e996260d nose/plugins/capture.py | |
--- a/nose/plugins/capture.py Tue May 05 19:22:53 2009 -0400 | |
+++ b/nose/plugins/capture.py Mon Sep 07 17:25:13 2009 -0700 | |
@@ -19,6 +19,9 @@ | |
log = logging.getLogger(__name__) | |
+class Buffer(StringIO): | |
+ fileno = lambda self : 1 | |
+ | |
class Capture(Plugin): | |
""" | |
Output capture plugin. Enabled by default. Disable with ``-s`` or | |
@@ -91,7 +94,7 @@ | |
def start(self): | |
self.stdout.append(sys.stdout) | |
- self._buf = StringIO() | |
+ self._buf = Buffer() | |
sys.stdout = self._buf | |
def end(self): | |
diff -r fda1e996260d nose/plugins/multiprocess.py | |
--- a/nose/plugins/multiprocess.py Tue May 05 19:22:53 2009 -0400 | |
+++ b/nose/plugins/multiprocess.py Mon Sep 07 17:25:13 2009 -0700 | |
@@ -97,10 +97,7 @@ | |
from nose.util import test_address | |
from Queue import Empty | |
from warnings import warn | |
-try: | |
- from cStringIO import StringIO | |
-except ImportError: | |
- import StringIO | |
+from StringIO import StringIO | |
log = logging.getLogger(__name__) | |
@@ -444,6 +441,8 @@ | |
mystorage.extend(storage) | |
log.debug("Ran %s tests (%s)", testsRun, result.testsRun) | |
+class Buffer(StringIO): | |
+ fileno = lambda self : 1 | |
def runner(ix, testQueue, resultQueue, shouldStop, | |
loaderClass, resultClass, config): | |
@@ -456,7 +455,7 @@ | |
return case | |
def makeResult(): | |
- stream = unittest._WritelnDecorator(StringIO()) | |
+ stream = unittest._WritelnDecorator(Buffer()) | |
result = resultClass(stream, descriptions=1, | |
verbosity=config.verbosity, | |
config=config) | |
diff -r fda1e996260d nose/plugins/plugintest.py | |
--- a/nose/plugins/plugintest.py Tue May 05 19:22:53 2009 -0400 | |
+++ b/nose/plugins/plugintest.py Mon Sep 07 17:25:13 2009 -0700 | |
@@ -99,13 +99,12 @@ | |
import sys | |
from warnings import warn | |
-try: | |
- from cStringIO import StringIO | |
-except ImportError: | |
- from StringIO import StringIO | |
+from StringIO import StringIO | |
__all__ = ['PluginTester', 'run'] | |
+class Buffer(StringIO): | |
+ fileno = lambda self : 1 | |
class PluginTester(object): | |
"""A mixin for testing nose plugins in their runtime environment. | |
@@ -177,7 +176,7 @@ | |
from nose.plugins.manager import PluginManager | |
suite = None | |
- stream = StringIO() | |
+ stream = Buffer() | |
conf = Config(env=self.env, | |
stream=stream, | |
plugins=PluginManager(plugins=self.plugins)) | |
@@ -273,6 +272,8 @@ | |
out = remove_timings(out) | |
return out.strip() | |
+class Buffer(StringIO): | |
+ fileno = lambda self : 1 | |
def run(*arg, **kw): | |
""" | |
@@ -296,7 +297,7 @@ | |
from nose.config import Config | |
from nose.plugins.manager import PluginManager | |
- buffer = StringIO() | |
+ buffer = Buffer() | |
if 'config' not in kw: | |
plugins = kw.pop('plugins', []) | |
if isinstance(plugins, list): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment