diff options
Diffstat (limited to 'tests/t3_fsck.py')
-rw-r--r-- | tests/t3_fsck.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/t3_fsck.py b/tests/t3_fsck.py index 6ca85a9..846e5d2 100644 --- a/tests/t3_fsck.py +++ b/tests/t3_fsck.py @@ -30,7 +30,11 @@ class fsck_tests(unittest.TestCase): self.cachedir = tempfile.mkdtemp() self.max_obj_size = 1024 - self.dbfile = tempfile.NamedTemporaryFile() + # Destructors are not guaranteed to run, and we can't unlink + # the file immediately because apsw refers to it by name. + # Therefore, we unlink the file manually in tearDown() + self.dbfile = tempfile.NamedTemporaryFile(delete=False) + self.db = Connection(self.dbfile.name) create_tables(self.db) init_tables(self.db) @@ -42,6 +46,7 @@ class fsck_tests(unittest.TestCase): def tearDown(self): shutil.rmtree(self.cachedir) shutil.rmtree(self.backend_dir) + os.unlink(self.dbfile.name) def assert_fsck(self, fn): '''Check that fn detects and corrects an error''' |