[Lldb-commits] [PATCH] Ignore teardown failure if it's caused by removing missing file or directory

Ying Chen chying at google.com
Mon Jun 29 20:32:41 PDT 2015


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10830.28747.patch
Type: text/x-patch
Size: 879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150630/33111163/attachment.bin>


More information about the lldb-commits mailing list