Rev 4892: Re-enable one of the subprocess tests. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-reconnect-819604

John Arbash Meinel john at arbash-meinel.com
Mon Oct 3 09:33:13 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-reconnect-819604

------------------------------------------------------------
revno: 4892
revision-id: john at arbash-meinel.com-20111003093255-w50xg5fvccjrba2v
parent: john at arbash-meinel.com-20110928151024-h2b3mr734iv09g5n
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-client-reconnect-819604
timestamp: Mon 2011-10-03 11:32:55 +0200
message:
  Re-enable one of the subprocess tests.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py	2011-09-28 15:10:24 +0000
+++ b/bzrlib/tests/test_smart_transport.py	2011-10-03 09:32:55 +0000
@@ -181,27 +181,27 @@
         client_medium._accept_bytes('abc')
         self.assertEqual('abc', output.getvalue())
 
-    # def test_simple_pipes__accept_bytes_subprocess_closed(self):
-    #     # It is unfortunate that we have to use Popen for this. However,
-    #     # os.pipe() does not behave the same as subprocess.Popen().
-    #     # On Windows, if you use os.pipe() and close the write side,
-    #     # read.read() hangs. On Linux, read.read() returns the empty string.
-    #     p = subprocess.Popen([sys.executable, '-c',
-    #         'import sys\n'
-    #         'sys.stdout.write(sys.stdin.read(3))\n'
-    #         'sys.stdout.close()\n'],
-    #         stdout=subprocess.PIPE, stdin=subprocess.PIPE)
-    #     client_medium = medium.SmartSimplePipesClientMedium(
-    #         p.stdout, p.stdin, 'base')
-    #     client_medium._accept_bytes('abc')
-    #     self.assertEqual('abc', client_medium._read_bytes(3))
-    #     p.wait()
-    #     # While writing to the underlying pipe,
-    #     #   Windows py2.6.6 we get IOError(EINVAL)
-    #     #   Lucid py2.6.5, we get IOError(EPIPE)
-    #     # In both cases, it should be wrapped to ConnectionReset
-    #     self.assertRaises(errors.ConnectionReset,
-    #                       client_medium._accept_bytes, 'more')
+    def test_simple_pipes__accept_bytes_subprocess_closed(self):
+        # It is unfortunate that we have to use Popen for this. However,
+        # os.pipe() does not behave the same as subprocess.Popen().
+        # On Windows, if you use os.pipe() and close the write side,
+        # read.read() hangs. On Linux, read.read() returns the empty string.
+        p = subprocess.Popen([sys.executable, '-c',
+            'import sys\n'
+            'sys.stdout.write(sys.stdin.read(3))\n'
+            'sys.stdout.close()\n'],
+            stdout=subprocess.PIPE, stdin=subprocess.PIPE)
+        client_medium = medium.SmartSimplePipesClientMedium(
+            p.stdout, p.stdin, 'base')
+        client_medium._accept_bytes('abc')
+        self.assertEqual('abc', client_medium._read_bytes(3))
+        p.wait()
+        # While writing to the underlying pipe,
+        #   Windows py2.6.6 we get IOError(EINVAL)
+        #   Lucid py2.6.5, we get IOError(EPIPE)
+        # In both cases, it should be wrapped to ConnectionReset
+        self.assertRaises(errors.ConnectionReset,
+                          client_medium._accept_bytes, 'more')
 
     def test_simple_pipes__accept_bytes_pipe_closed(self):
         child_read, client_write = create_file_pipes()



More information about the bazaar-commits mailing list