From f898e5ef190370b66028831ac0f232fbaa62d9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Thu, 17 Dec 2020 11:05:41 +0100 Subject: [PATCH] STY: ws changes --- unittests/test_cache.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/unittests/test_cache.py b/unittests/test_cache.py index 53fc1174..d3eb93a4 100644 --- a/unittests/test_cache.py +++ b/unittests/test_cache.py @@ -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() -- GitLab