##// END OF EJS Templates
tests: use getattr instead of hasattr
Augie Fackler -
r14971:0b21ae0a default
parent child Browse files
Show More
@@ -340,10 +340,7 b' def terminate(proc):'
340 """Terminate subprocess (with fallback for Python versions < 2.6)"""
340 """Terminate subprocess (with fallback for Python versions < 2.6)"""
341 vlog('# Terminating process %d' % proc.pid)
341 vlog('# Terminating process %d' % proc.pid)
342 try:
342 try:
343 if hasattr(proc, 'terminate'):
343 getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))()
344 proc.terminate()
345 else:
346 os.kill(proc.pid, signal.SIGTERM)
347 except OSError:
344 except OSError:
348 pass
345 pass
349
346
@@ -1,6 +1,5 b''
1 try:
1 try:
2 import coverage
2 import coverage
3 if hasattr(coverage, 'process_startup'):
3 getattr(coverage, 'process_startup', lambda: None)()
4 coverage.process_startup()
5 except ImportError:
4 except ImportError:
6 pass
5 pass
@@ -5,7 +5,7 b' from os import mkdir, chdir'
5 from os.path import join as pjoin
5 from os.path import join as pjoin
6
6
7 u = ui.ui()
7 u = ui.ui()
8 sym = hasattr(os, 'symlink') and hasattr(os.path, 'samestat')
8 sym = getattr(os, 'symlink', False) and getattr(os.path, 'samestat', False)
9
9
10 hg.repository(u, 'top1', create=1)
10 hg.repository(u, 'top1', create=1)
11 mkdir('subdir')
11 mkdir('subdir')
@@ -23,7 +23,8 b' class ProxyHandler (BaseHTTPServer.BaseH'
23
23
24 def handle(self):
24 def handle(self):
25 (ip, port) = self.client_address
25 (ip, port) = self.client_address
26 if hasattr(self, 'allowed_clients') and ip not in self.allowed_clients:
26 allowed = getattr(self, 'allowed_clients', None)
27 if allowed is not None and ip not in allowed:
27 self.raw_requestline = self.rfile.readline()
28 self.raw_requestline = self.rfile.readline()
28 if self.parse_request():
29 if self.parse_request():
29 self.send_error(403)
30 self.send_error(403)
General Comments 0
You need to be logged in to leave comments. Login now