diff testcases.py @ 134:e84f33a60a5c

Moved process killing logic into platform-specific modules
author Oleg Oshmyan <chortos@inbox.lv>
date Fri, 20 May 2011 14:47:42 +0100
parents 652028850ea4
children ed4035661b85
line wrap: on
line diff
--- a/testcases.py	Thu May 19 16:50:00 2011 +0100
+++ b/testcases.py	Fri May 20 14:47:42 2011 +0100
@@ -185,38 +185,14 @@
 			case.cleanup()
 	
 	def cleanup(case):
-		#if getattr(case, 'infile', None):
-		#	case.infile.close()
-		#if getattr(case, 'outfile', None):
-		#	case.outfile.close()
 		if getattr(case, 'process', None) and case.process.returncode is None:
-			# Try KILLing after three unsuccessful TERM attempts in a row
-			for i in range(3):
-				try:
-					terminate(case.process)
-				except Exception:
-					time.sleep(0)
-				else:
-					wait(case.process)
-					break
-			else:
-				# If killing the process is unsuccessful three times in a row,
-				# just silently stop trying
-				for i in range(3):
-					try:
-						kill(case.process)
-					except Exception:
-						time.sleep(0)
-					else:
-						wait(case.process)
-						break
-		if case.files_to_delete:
-			for name in case.files_to_delete:
-				try:
-					os.remove(name)
-				except Exception:
-					# It can't be helped
-					pass
+			kill(case.process)
+		for name in case.files_to_delete:
+			try:
+				os.remove(name)
+			except OSError:
+				# It can't be helped
+				pass
 	
 	def open_infile(case):
 		try: