aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyapd/stores/sqlite.py7
-rw-r--r--tests/test_sqlite_store.py3
2 files changed, 6 insertions, 4 deletions
diff --git a/pyapd/stores/sqlite.py b/pyapd/stores/sqlite.py
index 54af554..641600f 100644
--- a/pyapd/stores/sqlite.py
+++ b/pyapd/stores/sqlite.py
@@ -6,9 +6,10 @@ import sqlite3
class Store():
- def __init__(self):
- self.db = sqlite3.connect('pyad.db')
- self.objects = {}
+ def __init__(self, file=None):
+ if file is None:
+ file = ':memory:'
+ self.db = sqlite3.connect(file)
def add(self, obj: objects.Object):
obj_type = type(obj).__name__.lower()
diff --git a/tests/test_sqlite_store.py b/tests/test_sqlite_store.py
index 26ff45c..7c282b7 100644
--- a/tests/test_sqlite_store.py
+++ b/tests/test_sqlite_store.py
@@ -6,7 +6,8 @@ from pyapd.stores import sqlite, exceptions
class TestSqliteStore(unittest.TestCase):
def setUp(self):
- self.store = sqlite.Store()
+ self.store = sqlite.Store(file=':memory:')
+ self.store.createdb()
self.oid = 'https://test/object/12345'
self.obj = objects.Object(id=self.oid)
self.store.add(self.obj)