Hi vharron, tberghammer,

This is aiming to workaround this issue:
When test is decorated with expectedFlakey* and has teardown hook attached, the 
teardown hook will be added and executed twice,
the second execution will fail due to "missing file".

http://reviews.llvm.org/D10830

Files:
  test/unittest2/case.py

Index: test/unittest2/case.py
===================================================================
--- test/unittest2/case.py
+++ test/unittest2/case.py
@@ -382,9 +382,13 @@
 
                 try:
                     self.tearDown()
-                except Exception:
-                    result.addError(self, sys.exc_info())
-                    success = False
+                except Exception, e:
+                    # ignore teardown failure if it's caused by removing 
missing file or directory
+                    if isinstance(e, OSError) and "No such file or directory" 
in e.args:
+                        warnings.warn(sys.exc_info())
+                    else:
+                        result.addError(self, sys.exc_info())
+                        success = False
 
             cleanUpSuccess = self.doCleanups()
             success = success and cleanUpSuccess

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: test/unittest2/case.py
===================================================================
--- test/unittest2/case.py
+++ test/unittest2/case.py
@@ -382,9 +382,13 @@
 
                 try:
                     self.tearDown()
-                except Exception:
-                    result.addError(self, sys.exc_info())
-                    success = False
+                except Exception, e:
+                    # ignore teardown failure if it's caused by removing missing file or directory
+                    if isinstance(e, OSError) and "No such file or directory" in e.args:
+                        warnings.warn(sys.exc_info())
+                    else:
+                        result.addError(self, sys.exc_info())
+                        success = False
 
             cleanUpSuccess = self.doCleanups()
             success = success and cleanUpSuccess
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to