OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved. | 2 # Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 import os | 30 import os |
31 import errno | 31 import errno |
32 import signal | 32 import signal |
33 import subprocess | 33 import subprocess |
34 import sys | 34 import sys |
35 import time | 35 import time |
| 36 import unittest |
36 | 37 |
37 # Since we execute this script directly as part of the unit tests, we need to en
sure | 38 # Since we execute this script directly as part of the unit tests, we need to en
sure |
38 # that Tools/Scripts and Tools/Scripts/thirdparty are in sys.path for the next i
mports to work correctly. | 39 # that Tools/Scripts and Tools/Scripts/thirdparty are in sys.path for the next i
mports to work correctly. |
39 script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.
path.abspath(__file__))))) | 40 script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.
path.abspath(__file__))))) |
40 if script_dir not in sys.path: | 41 if script_dir not in sys.path: |
41 sys.path.append(script_dir) | 42 sys.path.append(script_dir) |
42 third_party_py = os.path.join(script_dir, "webkitpy", "thirdparty") | 43 third_party_py = os.path.join(script_dir, "webkitpy", "thirdparty") |
43 if third_party_py not in sys.path: | 44 if third_party_py not in sys.path: |
44 sys.path.append(third_party_py) | 45 sys.path.append(third_party_py) |
45 | 46 |
46 import webkitpy.thirdparty.unittest2 as unittest | |
47 | 47 |
48 from webkitpy.common.system.executive import Executive, ScriptError | 48 from webkitpy.common.system.executive import Executive, ScriptError |
49 from webkitpy.common.system.filesystem_mock import MockFileSystem | 49 from webkitpy.common.system.filesystem_mock import MockFileSystem |
50 | 50 |
51 | 51 |
52 class ScriptErrorTest(unittest.TestCase): | 52 class ScriptErrorTest(unittest.TestCase): |
53 def test_message_with_output(self): | 53 def test_message_with_output(self): |
54 error = ScriptError('My custom message!', '', -1) | 54 error = ScriptError('My custom message!', '', -1) |
55 self.assertEqual(error.message_with_output(), 'My custom message!') | 55 self.assertEqual(error.message_with_output(), 'My custom message!') |
56 error = ScriptError('My custom message!', '', -1, 'My output.') | 56 error = ScriptError('My custom message!', '', -1, 'My output.') |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 import msvcrt | 211 import msvcrt |
212 msvcrt.setmode(stdout.fileno(), os.O_BINARY) | 212 msvcrt.setmode(stdout.fileno(), os.O_BINARY) |
213 if cmd == '--cat': | 213 if cmd == '--cat': |
214 stdout.write(stdin.read()) | 214 stdout.write(stdin.read()) |
215 elif cmd == '--echo': | 215 elif cmd == '--echo': |
216 stdout.write(' '.join(args)) | 216 stdout.write(' '.join(args)) |
217 return 0 | 217 return 0 |
218 | 218 |
219 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '--
echo'): | 219 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '--
echo'): |
220 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:]
)) | 220 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:]
)) |
OLD | NEW |