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

Side by Side Diff: testing_support/fake_repos.py

Issue 8749005: Silence pylint on Mac OSX 10.6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years 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
« no previous file with comments | « subprocess2.py ('k') | tests/subprocess2_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """Generate fake repositories for testing.""" 6 """Generate fake repositories for testing."""
7 7
8 import atexit 8 import atexit
9 import datetime 9 import datetime
10 import errno 10 import errno
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 118
119 def wait_for_port_to_bind(host, port, process): 119 def wait_for_port_to_bind(host, port, process):
120 sock = socket.socket() 120 sock = socket.socket()
121 121
122 if sys.platform == 'darwin': 122 if sys.platform == 'darwin':
123 # On Mac SnowLeopard, if we attempt to connect to the socket 123 # On Mac SnowLeopard, if we attempt to connect to the socket
124 # immediately, it fails with EINVAL and never gets a chance to 124 # immediately, it fails with EINVAL and never gets a chance to
125 # connect (putting us into a hard spin and then failing). 125 # connect (putting us into a hard spin and then failing).
126 # Linux doesn't need this. 126 # Linux doesn't need this.
127 time.sleep(0.1) 127 time.sleep(0.2)
128 128
129 try: 129 try:
130 start = datetime.datetime.utcnow() 130 start = datetime.datetime.utcnow()
131 maxdelay = datetime.timedelta(seconds=30) 131 maxdelay = datetime.timedelta(seconds=30)
132 while (datetime.datetime.utcnow() - start) < maxdelay: 132 while (datetime.datetime.utcnow() - start) < maxdelay:
133 try: 133 try:
134 sock.connect((host, port)) 134 sock.connect((host, port))
135 logging.debug('%d is now bound' % port) 135 logging.debug('%d is now bound' % port)
136 return 136 return
137 except (socket.error, EnvironmentError): 137 except (socket.error, EnvironmentError):
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 fake.set_up_git() 743 fake.set_up_git()
744 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') 744 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.')
745 sys.stdin.readline() 745 sys.stdin.readline()
746 except KeyboardInterrupt: 746 except KeyboardInterrupt:
747 trial_dir.TrialDir.SHOULD_LEAK.leak = True 747 trial_dir.TrialDir.SHOULD_LEAK.leak = True
748 return 0 748 return 0
749 749
750 750
751 if __name__ == '__main__': 751 if __name__ == '__main__':
752 sys.exit(main(sys.argv)) 752 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « subprocess2.py ('k') | tests/subprocess2_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698