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 18 matching lines...) Expand all Loading... |
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 import unittest |
37 | 37 |
38 # 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 |
39 # that Tools/Scripts and Tools/Scripts/thirdparty are in sys.path for the next i
mports to work correctly. | 39 # that Tools/Scripts is in sys.path for the next imports to work correctly. |
40 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__))))) |
41 if script_dir not in sys.path: | 41 if script_dir not in sys.path: |
42 sys.path.append(script_dir) | 42 sys.path.append(script_dir) |
43 third_party_py = os.path.join(script_dir, "webkitpy", "thirdparty") | |
44 if third_party_py not in sys.path: | |
45 sys.path.append(third_party_py) | |
46 | 43 |
47 | 44 |
48 from webkitpy.common.system.executive import Executive, ScriptError | 45 from webkitpy.common.system.executive import Executive, ScriptError |
49 from webkitpy.common.system.filesystem_mock import MockFileSystem | 46 from webkitpy.common.system.filesystem_mock import MockFileSystem |
50 | 47 |
51 | 48 |
52 class ScriptErrorTest(unittest.TestCase): | 49 class ScriptErrorTest(unittest.TestCase): |
53 def test_message_with_output(self): | 50 def test_message_with_output(self): |
54 error = ScriptError('My custom message!', '', -1) | 51 error = ScriptError('My custom message!', '', -1) |
55 self.assertEqual(error.message_with_output(), 'My custom message!') | 52 self.assertEqual(error.message_with_output(), 'My custom message!') |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 import msvcrt | 208 import msvcrt |
212 msvcrt.setmode(stdout.fileno(), os.O_BINARY) | 209 msvcrt.setmode(stdout.fileno(), os.O_BINARY) |
213 if cmd == '--cat': | 210 if cmd == '--cat': |
214 stdout.write(stdin.read()) | 211 stdout.write(stdin.read()) |
215 elif cmd == '--echo': | 212 elif cmd == '--echo': |
216 stdout.write(' '.join(args)) | 213 stdout.write(' '.join(args)) |
217 return 0 | 214 return 0 |
218 | 215 |
219 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '--
echo'): | 216 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:]
)) | 217 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:]
)) |
OLD | NEW |