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

Side by Side Diff: Tools/Scripts/webkitpy/common/system/executive_unittest.py

Issue 18418010: Check in the thirdparty libs needed for webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
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 21 matching lines...) Expand all
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 36
37 # Since we execute this script directly as part of the unit tests, we need to en sure 37 # Since we execute this script directly as part of the unit tests, we need to en sure
38 # that Tools/Scripts is in sys.path for the next imports to work correctly. 38 # that Tools/Scripts is in sys.path for the next imports to work correctly.
39 script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os. path.abspath(__file__))))) 39 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: 40 if script_dir not in sys.path:
41 sys.path.append(script_dir) 41 sys.path.append(script_dir)
42 third_party_py = os.path.join(script_dir, "webkitpy", "thirdparty", "autoinstall ed")
43 if third_party_py not in sys.path:
44 sys.path.append(third_party_py)
45
46 import unittest2 as unittest
47 42
48 from webkitpy.common.system.executive import Executive, ScriptError 43 from webkitpy.common.system.executive import Executive, ScriptError
49 from webkitpy.common.system.filesystem_mock import MockFileSystem 44 from webkitpy.common.system.filesystem_mock import MockFileSystem
45 from webkitpy.thirdparty import unittest2 as unittest
50 46
51 47
52 class ScriptErrorTest(unittest.TestCase): 48 class ScriptErrorTest(unittest.TestCase):
53 def test_message_with_output(self): 49 def test_message_with_output(self):
54 error = ScriptError('My custom message!', '', -1) 50 error = ScriptError('My custom message!', '', -1)
55 self.assertEqual(error.message_with_output(), 'My custom message!') 51 self.assertEqual(error.message_with_output(), 'My custom message!')
56 error = ScriptError('My custom message!', '', -1, 'My output.') 52 error = ScriptError('My custom message!', '', -1, 'My output.')
57 self.assertEqual(error.message_with_output(), 'My custom message!\n\nout put: My output.') 53 self.assertEqual(error.message_with_output(), 'My custom message!\n\nout put: My output.')
58 error = ScriptError('', 'my_command!', -1, 'My output.', '/Users/usernam e/blah') 54 error = ScriptError('', 'my_command!', -1, 'My output.', '/Users/usernam e/blah')
59 self.assertEqual(error.message_with_output(), 'Failed to run "\'my_comma nd!\'" exit_code: -1 cwd: /Users/username/blah\n\noutput: My output.') 55 self.assertEqual(error.message_with_output(), 'Failed to run "\'my_comma nd!\'" exit_code: -1 cwd: /Users/username/blah\n\noutput: My output.')
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 import msvcrt 238 import msvcrt
243 msvcrt.setmode(stdout.fileno(), os.O_BINARY) 239 msvcrt.setmode(stdout.fileno(), os.O_BINARY)
244 if cmd == '--cat': 240 if cmd == '--cat':
245 stdout.write(stdin.read()) 241 stdout.write(stdin.read())
246 elif cmd == '--echo': 242 elif cmd == '--echo':
247 stdout.write(' '.join(args)) 243 stdout.write(' '.join(args))
248 return 0 244 return 0
249 245
250 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '-- echo'): 246 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '-- echo'):
251 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:] )) 247 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:] ))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698