]> granicus.if.org Git - python/commitdiff
Catch OSError when trying to remove a file in case removal fails. This
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 5 Mar 2008 05:20:44 +0000 (05:20 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 5 Mar 2008 05:20:44 +0000 (05:20 +0000)
should prevent a failure in tearDown masking any real test failure.

Lib/sqlite3/test/transactions.py

index 14cae25001a4eb9ff9582b450f042f0b5d1745e7..d4f7d622ed84821c39c6af0dea4fce88bc36ab34 100644 (file)
@@ -32,7 +32,7 @@ class TransactionTests(unittest.TestCase):
     def setUp(self):
         try:
             os.remove(get_db_path())
-        except:
+        except OSError:
             pass
 
         self.con1 = sqlite.connect(get_db_path(), timeout=0.1)
@@ -48,7 +48,10 @@ class TransactionTests(unittest.TestCase):
         self.cur2.close()
         self.con2.close()
 
-        os.unlink(get_db_path())
+        try:
+            os.unlink(get_db_path())
+        except OSError:
+            pass
 
     def CheckDMLdoesAutoCommitBefore(self):
         self.cur1.execute("create table test(i)")