From 4c0370c8923c724ac25e44d679439de292ae5c08 Mon Sep 17 00:00:00 2001 From: "David H. Irving" Date: Tue, 10 Dec 2024 15:56:52 -0700 Subject: [PATCH] Fix failure of sqlite test when using system temp dir Fix an issue where a test for equality of filenames in the system temp directory were failing. On MacOS, /private/tmp and /tmp refer to the same directory. --- tests/test_sqlite.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py index 2a6385f83f..db823256a9 100644 --- a/tests/test_sqlite.py +++ b/tests/test_sqlite.py @@ -103,13 +103,13 @@ def testConnection(self): _, filename = tempfile.mkstemp(dir=self.root, suffix=".sqlite3") # Create a read-write database by passing in the filename. rwFromFilename = SqliteDatabase.fromEngine(SqliteDatabase.makeEngine(filename=filename), origin=0) - self.assertEqual(rwFromFilename.filename, filename) + self.assertEqual(os.path.realpath(rwFromFilename.filename), os.path.realpath(filename)) self.assertEqual(rwFromFilename.origin, 0) self.assertTrue(rwFromFilename.isWriteable()) self.assertTrue(isEmptyDatabaseActuallyWriteable(rwFromFilename)) # Create a read-write database via a URI. rwFromUri = SqliteDatabase.fromUri(f"sqlite:///{filename}", origin=0) - self.assertEqual(rwFromUri.filename, filename) + self.assertEqual(os.path.realpath(rwFromUri.filename), os.path.realpath(filename)) self.assertEqual(rwFromUri.origin, 0) self.assertTrue(rwFromUri.isWriteable()) self.assertTrue(isEmptyDatabaseActuallyWriteable(rwFromUri)) @@ -123,13 +123,13 @@ def testConnection(self): roFromFilename = SqliteDatabase.fromEngine( SqliteDatabase.makeEngine(filename=filename), origin=0, writeable=False ) - self.assertEqual(roFromFilename.filename, filename) + self.assertEqual(os.path.realpath(roFromFilename.filename), os.path.realpath(filename)) self.assertEqual(roFromFilename.origin, 0) self.assertFalse(roFromFilename.isWriteable()) self.assertFalse(isEmptyDatabaseActuallyWriteable(roFromFilename)) # Create a read-write database via a URI. roFromUri = SqliteDatabase.fromUri(f"sqlite:///{filename}", origin=0, writeable=False) - self.assertEqual(roFromUri.filename, filename) + self.assertEqual(os.path.realpath(roFromUri.filename), os.path.realpath(filename)) self.assertEqual(roFromUri.origin, 0) self.assertFalse(roFromUri.isWriteable()) self.assertFalse(isEmptyDatabaseActuallyWriteable(roFromUri))