Anonymous avatar Anonymous committed 2e8d2d7

Switch regrtest to use StringIO instead of cStringIO for test_multiprocessing on Windows. Issue 8333.

Comments (0)

Files changed (2)

Lib/test/regrtest.py

 option '-uall,-bsddb'.
 """
 
-import cStringIO
+import StringIO
 import getopt
 import json
 import os
     if verbose:
         capture_stdout = None
     else:
-        capture_stdout = cStringIO.StringIO()
+        capture_stdout = StringIO.StringIO()
 
     test_time = 0.0
     refleak = False  # True if the test leaked references.

Lib/test/test_argparse.py

 
 from StringIO import StringIO
 
+class StdIOBuffer(StringIO):
+    pass
+
 from test import test_support
 
 class TestCase(unittest.TestCase):
         super(TestCase, self).assertEqual(obj1, obj2)
 
 
+
 class TempDirMixin(object):
 
     def setUp(self):
     # if this is being called recursively and stderr or stdout is already being
     # redirected, simply call the function and let the enclosing function
     # catch the exception
-    if isinstance(sys.stderr, StringIO) or isinstance(sys.stdout, StringIO):
+    if isinstance(sys.stderr, StdIOBuffer) or isinstance(sys.stdout, StdIOBuffer):
         return parse_args(*args, **kwargs)
 
     # if this is not being called recursively, redirect stderr and
     # use it as the ArgumentParserError message
     old_stdout = sys.stdout
     old_stderr = sys.stderr
-    sys.stdout = StringIO()
-    sys.stderr = StringIO()
+    sys.stdout = StdIOBuffer()
+    sys.stderr = StdIOBuffer()
     try:
         try:
             result = parse_args(*args, **kwargs)
                 parser = self._get_parser(tester)
                 print_ = getattr(parser, 'print_%s' % self.func_suffix)
                 old_stream = getattr(sys, self.std_name)
-                setattr(sys, self.std_name, StringIO())
+                setattr(sys, self.std_name, StdIOBuffer())
                 try:
                     print_()
                     parser_text = getattr(sys, self.std_name).getvalue()
             def test_print_file(self, tester):
                 parser = self._get_parser(tester)
                 print_ = getattr(parser, 'print_%s' % self.func_suffix)
-                sfile = StringIO()
+                sfile = StdIOBuffer()
                 print_(sfile)
                 parser_text = sfile.getvalue()
                 self._test(tester, parser_text)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.