Skip to content
Snippets Groups Projects
Commit f898e5ef authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

STY: ws changes

parent 0f2533f4
No related branches found
No related tags found
2 merge requests!59FIX: if multiple updates for one entity exist, the retrieve would result in an...,!46F cache version
......@@ -75,7 +75,7 @@ class CacheTest(unittest.TestCase):
# TODO: is that wanted?
self.assertEqual(ent.id, -1)
self.assertEqual(ent3.id, -1)
# TODO: I expected this instead:
# with pytest.raises(RuntimeError, match=r".*no ID.*"):
# self.cache.insert_list(hashes, entities)
......@@ -94,6 +94,7 @@ class CacheTest(unittest.TestCase):
self.assertEqual(self.cache.check_existing(hashes[0])[0], 1001)
self.assertEqual(self.cache.check_existing(hashes[2])[0], 1003)
def create_sqlite_file(commands):
"""
A temporary file will be used
......@@ -108,12 +109,13 @@ def create_sqlite_file(commands):
conn.commit()
conn.close()
return db_file
class CacheTest2(unittest.TestCase):
"""
Test the schema version.
"""
def setUp(self):
# Correct version:
self.cache = Cache(db_file=NamedTemporaryFile(delete=False).name,
......@@ -144,8 +146,6 @@ class CacheTest2(unittest.TestCase):
('''CREATE TABLE version (schema INTEGER)''',),
("INSERT INTO version VALUES (?)", (1,)),
("INSERT INTO version VALUES (?)", (3,))])])
def test_schema(self):
# Test whether new cache is created correctly:
......@@ -175,11 +175,12 @@ class CacheTest2(unittest.TestCase):
for db_fn_defect in self.db_file_defect:
os.remove(db_fn_defect)
class InvalidationTest(unittest.TestCase):
"""
Test invalidation of cache entries.
"""
def setUp(self):
# Correct version:
self.cache = Cache(db_file=NamedTemporaryFile(delete=False).name,
......@@ -188,7 +189,6 @@ class InvalidationTest(unittest.TestCase):
def tearDown(self):
os.remove(self.cache.db_file)
def test_invalid(self):
ent = db.Record()
ent2 = db.Record()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment