| OLD | NEW | 
|    1 #!/usr/bin/env python |    1 #!/usr/bin/env python | 
|    2 # Copyright 2013 The LUCI Authors. All rights reserved. |    2 # Copyright 2013 The LUCI Authors. All rights reserved. | 
|    3 # Use of this source code is governed under the Apache License, Version 2.0 |    3 # Use of this source code is governed under the Apache License, Version 2.0 | 
|    4 # that can be found in the LICENSE file. |    4 # that can be found in the LICENSE file. | 
|    5  |    5  | 
|    6 import itertools |    6 import itertools | 
|    7 import logging |    7 import logging | 
|    8 import os |    8 import os | 
|    9 import sys |    9 import sys | 
|   10 import tempfile |   10 import tempfile | 
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  658         self.assertEqual(1, proc.wait()) |  658         self.assertEqual(1, proc.wait()) | 
|  659         self.assertEqual((None, None), proc.recv_any()) |  659         self.assertEqual((None, None), proc.recv_any()) | 
|  660       else: |  660       else: | 
|  661         self.assertEqual(0, proc.wait()) |  661         self.assertEqual(0, proc.wait()) | 
|  662         self.assertEqual(('stdout', 'got signal 15\nbye\n'), proc.recv_any()) |  662         self.assertEqual(('stdout', 'got signal 15\nbye\n'), proc.recv_any()) | 
|  663     finally: |  663     finally: | 
|  664       # In case the test fails. |  664       # In case the test fails. | 
|  665       proc.kill() |  665       proc.kill() | 
|  666       proc.wait() |  666       proc.wait() | 
|  667  |  667  | 
 |  668   def test_split(self): | 
 |  669     data = [ | 
 |  670       ('stdout', 'o1\no2\no3\n'), | 
 |  671       ('stderr', 'e1\ne2\ne3\n'), | 
 |  672       ('stdout', '\n\n'), | 
 |  673       ('stdout', '\n'), | 
 |  674       ('stdout', 'o4\no5'), | 
 |  675       ('stdout', '_sameline\npart1 of one line '), | 
 |  676       ('stderr', 'err inserted between two parts of stdout\n'), | 
 |  677       ('stdout', 'part2 of one line\n'), | 
 |  678       ('stdout', 'incomplete last stdout'), | 
 |  679       ('stderr', 'incomplete last stderr'), | 
 |  680     ] | 
 |  681     self.assertEquals(list(subprocess42.split(data)), [ | 
 |  682       ('stdout', 'o1'), | 
 |  683       ('stdout', 'o2'), | 
 |  684       ('stdout', 'o3'), | 
 |  685       ('stderr', 'e1'), | 
 |  686       ('stderr', 'e2'), | 
 |  687       ('stderr', 'e3'), | 
 |  688       ('stdout', ''), | 
 |  689       ('stdout', ''), | 
 |  690       ('stdout', ''), | 
 |  691       ('stdout', 'o4'), | 
 |  692       ('stdout', 'o5_sameline'), | 
 |  693       ('stderr', 'err inserted between two parts of stdout'), | 
 |  694       ('stdout', 'part1 of one line part2 of one line'), | 
 |  695       ('stderr', 'incomplete last stderr'), | 
 |  696       ('stdout', 'incomplete last stdout'), | 
 |  697     ]) | 
|  668  |  698  | 
|  669 if __name__ == '__main__': |  699 if __name__ == '__main__': | 
|  670   if '-v' in sys.argv: |  700   if '-v' in sys.argv: | 
|  671     unittest.TestCase.maxDiff = None |  701     unittest.TestCase.maxDiff = None | 
|  672   logging.basicConfig( |  702   logging.basicConfig( | 
|  673       level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) |  703       level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) | 
|  674   unittest.main() |  704   unittest.main() | 
| OLD | NEW |