| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import StringIO | 7 import StringIO |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 10 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class GclientUtilsUnittest(GclientUtilBase): | 27 class GclientUtilsUnittest(GclientUtilBase): |
| 28 """General gclient_utils.py tests.""" | 28 """General gclient_utils.py tests.""" |
| 29 def testMembersChanged(self): | 29 def testMembersChanged(self): |
| 30 members = [ | 30 members = [ |
| 31 'Annotated', 'AutoFlush', 'CheckCallAndFilter', | 31 'Annotated', 'AutoFlush', 'CheckCallAndFilter', |
| 32 'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead', | 32 'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead', |
| 33 'FileWrite', 'FindFileUpwards', 'FindGclientRoot', | 33 'FileWrite', 'FindFileUpwards', 'FindGclientRoot', |
| 34 'GetGClientRootAndEntries', 'GetEditor', 'IsDateRevision', | 34 'GetGClientRootAndEntries', 'GetEditor', 'IsDateRevision', |
| 35 'MakeDateRevision', 'MakeFileAutoFlush', 'MakeFileAnnotated', | 35 'MakeDateRevision', 'MakeFileAutoFlush', 'MakeFileAnnotated', |
| 36 'PathDifference', 'ParseCodereviewSettingsContent', 'NumLocalCpus', | 36 'PathDifference', 'ParseCodereviewSettingsContent', 'NumLocalCpus', |
| 37 'PrintableObject', 'RunEditor', | 37 'PrintableObject', 'RunEditor', 'GClientChildrenSingleton', |
| 38 'SplitUrlRevision', 'SyntaxErrorToError', 'UpgradeToHttps', 'Wrapper', | 38 'SplitUrlRevision', 'SyntaxErrorToError', 'UpgradeToHttps', 'Wrapper', |
| 39 'WorkItem', 'codecs', 'lockedmethod', 'logging', 'os', 'Queue', 're', | 39 'WorkItem', 'codecs', 'lockedmethod', 'logging', 'os', 'Queue', 're', |
| 40 'rmtree', 'safe_makedirs', 'stat', 'subprocess', 'subprocess2', 'sys', | 40 'rmtree', 'safe_makedirs', 'stat', 'subprocess', 'subprocess2', 'sys', |
| 41 'tempfile', 'threading', 'time', 'urlparse', | 41 'tempfile', 'threading', 'time', 'urlparse', 'KillAllRemainingChildren' |
| 42 ] | 42 ] |
| 43 # If this test fails, you should add the relevant test. | 43 # If this test fails, you should add the relevant test. |
| 44 self.compareMembers(gclient_utils, members) | 44 self.compareMembers(gclient_utils, members) |
| 45 | 45 |
| 46 | 46 |
| 47 | 47 |
| 48 class CheckCallAndFilterTestCase(GclientUtilBase): | 48 class CheckCallAndFilterTestCase(GclientUtilBase): |
| 49 class ProcessIdMock(object): | 49 class ProcessIdMock(object): |
| 50 def __init__(self, test_string): | 50 def __init__(self, test_string): |
| 51 self.stdout = StringIO.StringIO(test_string) | 51 self.stdout = StringIO.StringIO(test_string) |
| 52 self.pid = 9284 |
| 52 def wait(self): | 53 def wait(self): |
| 53 pass | 54 pass |
| 54 | 55 |
| 55 def _inner(self, args, test_string): | 56 def _inner(self, args, test_string): |
| 56 cwd = 'bleh' | 57 cwd = 'bleh' |
| 57 gclient_utils.sys.stdout.write( | 58 gclient_utils.sys.stdout.write( |
| 58 '\n________ running \'boo foo bar\' in \'bleh\'\n') | 59 '\n________ running \'boo foo bar\' in \'bleh\'\n') |
| 59 for i in test_string: | 60 for i in test_string: |
| 60 gclient_utils.sys.stdout.write(i) | 61 gclient_utils.sys.stdout.write(i) |
| 61 # pylint: disable=E1101 | 62 # pylint: disable=E1101 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 for content, expected in values: | 211 for content, expected in values: |
| 211 self.assertEquals( | 212 self.assertEquals( |
| 212 expected, gclient_utils.ParseCodereviewSettingsContent(content)) | 213 expected, gclient_utils.ParseCodereviewSettingsContent(content)) |
| 213 | 214 |
| 214 | 215 |
| 215 if __name__ == '__main__': | 216 if __name__ == '__main__': |
| 216 import unittest | 217 import unittest |
| 217 unittest.main() | 218 unittest.main() |
| 218 | 219 |
| 219 # vim: ts=2:sw=2:tw=80:et: | 220 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |