##// END OF EJS Templates
tests: remove Python 2 special cases in test-stdio.py
Manuel Jacob -
r50192:402f9f0f default
parent child Browse files
Show More
@@ -211,22 +211,7 b' class TestStdio(unittest.TestCase):'
211 def test_buffering_stdout_ptys_unbuffered(self):
211 def test_buffering_stdout_ptys_unbuffered(self):
212 self._test_buffering('stdout', _ptys, UNBUFFERED, python_args=['-u'])
212 self._test_buffering('stdout', _ptys, UNBUFFERED, python_args=['-u'])
213
213
214 if not pycompat.ispy3 and not pycompat.iswindows:
215 # On Python 2 on non-Windows, we manually open stdout in line-buffered
216 # mode if connected to a TTY. We should check if Python was configured
217 # to use unbuffered stdout, but it's hard to do that.
218 test_buffering_stdout_ptys_unbuffered = unittest.expectedFailure(
219 test_buffering_stdout_ptys_unbuffered
220 )
221
222 def _test_large_write(self, stream, rwpair_generator, python_args=[]):
214 def _test_large_write(self, stream, rwpair_generator, python_args=[]):
223 if not pycompat.ispy3 and pycompat.isdarwin:
224 # Python 2 doesn't always retry on EINTR, but the libc might retry.
225 # So far, it was observed only on macOS that EINTR is raised at the
226 # Python level. As Python 2 support will be dropped soon-ish, we
227 # won't attempt to fix it.
228 raise unittest.SkipTest("raises EINTR on macOS")
229
230 def check_output(stream_receiver, proc):
215 def check_output(stream_receiver, proc):
231 if not pycompat.iswindows:
216 if not pycompat.iswindows:
232 # On Unix, we can provoke a partial write() by interrupting it
217 # On Unix, we can provoke a partial write() by interrupting it
@@ -243,16 +228,7 b' class TestStdio(unittest.TestCase):'
243 )
228 )
244
229
245 def post_child_check():
230 def post_child_check():
246 write_result_str = write_result_f.read()
231 self.assertEqual(write_result_f.read(), '1048576')
247 if pycompat.ispy3:
248 # On Python 3, we test that the correct number of bytes is
249 # claimed to have been written.
250 expected_write_result_str = '1048576'
251 else:
252 # On Python 2, we only check that the large write does not
253 # crash.
254 expected_write_result_str = 'None'
255 self.assertEqual(write_result_str, expected_write_result_str)
256
232
257 with tempfile.NamedTemporaryFile('r') as write_result_f:
233 with tempfile.NamedTemporaryFile('r') as write_result_f:
258 self._test(
234 self._test(
General Comments 0
You need to be logged in to leave comments. Login now