Skip to content

Commit

Permalink
Fix failure of sqlite test when using system temp dir
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dhirving committed Jan 3, 2025
1 parent 5fe1c33 commit 4c0370c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down

0 comments on commit 4c0370c

Please sign in to comment.