pytest/samdb_api: use TestCaseInTempDir.rm_files
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 15 Jun 2022 01:20:41 +0000 (13:20 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 6 Sep 2022 21:12:36 +0000 (21:12 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
python/samba/tests/samdb_api.py

index a7260180187cf7311322552c2367d0a66a3c1b08..710d0bc310fbb010fc4e966cfa50c1e02f4716d0 100644 (file)
@@ -29,15 +29,7 @@ class SamDBApiTestCase(TestCaseInTempDir):
         super(SamDBApiTestCase, self).setUp()
 
     def tearDown(self):
-        try:
-            os.remove(self.tempdir + "/test.db")
-        except OSError as e:
-            self.assertEqual(e.errno, errno.ENOENT)
-
-        try:
-            os.remove(self.tempdir + "/existing.db")
-        except OSError as e:
-            self.assertEqual(e.errno, errno.ENOENT)
+        self.rm_files("test.db", "existing.db", allow_missing=True)
 
         super(SamDBApiTestCase, self).tearDown()