tests: use getattr instead of hasattr stable
authorAugie Fackler <durin42@gmail.com>
Mon, 25 Jul 2011 16:37:18 -0500
branchstable
changeset 977 a50ed14997fc
parent 975 98fa0fa48b7d
child 978 600f20908ede
child 980 d487504115fe
tests: use getattr instead of hasattr [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Wed Jul 13 19:23:08 2011 +0200
+++ b/tests/run-tests.py	Mon Jul 25 16:37:18 2011 -0500
@@ -340,10 +340,7 @@
     """Terminate subprocess (with fallback for Python versions < 2.6)"""
     vlog('# Terminating process %d' % proc.pid)
     try:
-        if hasattr(proc, 'terminate'):
-            proc.terminate()
-        else:
-            os.kill(proc.pid, signal.SIGTERM)
+        getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))()
     except OSError:
         pass