Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2260)

Side by Side Diff: client/tests/subprocess42_test.py

Issue 2037253002: run_isolated.py: install CIPD packages (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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\nincomplete'),
676 ('stderr', 'forces previous chunk to be yielded\n'),
677 ('stdout', 'incomplete last one'),
678 ]
679 self.assertEquals(list(subprocess42.split(data)), [
680 ('stdout', 'o1'),
681 ('stdout', 'o2'),
682 ('stdout', 'o3'),
683 ('stderr', 'e1'),
684 ('stderr', 'e2'),
685 ('stderr', 'e3'),
686 ('stdout', ''),
687 ('stdout', ''),
688 ('stdout', ''),
689 ('stdout', 'o4'),
690 ('stdout', 'o5_sameline'),
691 ('stdout', 'incomplete'),
692 ('stderr', 'forces previous chunk to be yielded'),
693 ('stdout', 'incomplete last one'),
694 ])
668 695
669 if __name__ == '__main__': 696 if __name__ == '__main__':
670 if '-v' in sys.argv: 697 if '-v' in sys.argv:
671 unittest.TestCase.maxDiff = None 698 unittest.TestCase.maxDiff = None
672 logging.basicConfig( 699 logging.basicConfig(
673 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) 700 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
674 unittest.main() 701 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698