Permalink
Browse files

Changes to fix an error thrown up on OSX

  • Loading branch information...
1 parent f50684a commit b9d63f282466ad92eabd35ad7fb9d9df9b05d6a6 @zathras777 committed Feb 8, 2012
Showing with 15 additions and 10 deletions.
  1. +15 −10 tests/sqlite_test.py
View
@@ -4,18 +4,23 @@
from slurpy.databases.sqlite import SqliteDatabase
+testDir = os.path.dirname(__file__)
+
class TestDB(unittest.TestCase):
+ def setUp(self):
+ self.db = SqliteDatabase()
+
def test_001(self):
- db = SqliteDatabase()
- self.assertNotEqual(db, None)
- self.assertRaises(ValueError, db.connect)
- os.unlink('tests.db')
- self.assertEqual(db.connect(dbname = 'tests.db'), True)
- self.assertEqual(db.close(), True)
- self.assertEqual(db.close(), True)
+ self.assertNotEqual(self.db, None)
+ self.assertRaises(ValueError, self.db.connect)
+ fn = os.path.join(testDir, 'tests.db')
+ if os.path.exists(fn):
+ os.unlink(fn)
+ self.assertEqual(self.db.connect(dbname = fn), True)
+ self.assertEqual(self.db.close(), True)
+ self.assertEqual(self.db.close(), True)
def test_002_simple(self):
- db = SqliteDatabase()
- self.assertNotEqual(db, None)
- self.assertEqual(db.connect(dbname = ':memory:'), True)
+ self.assertNotEqual(self.db, None)
+ self.assertEqual(self.db.connect(dbname = ':memory:'), True)

0 comments on commit b9d63f2

Please sign in to comment.