Define a base class for testing the objects
This commit is contained in:
parent
aa28ab37da
commit
2836f15d3c
|
@ -19,19 +19,14 @@ from minode import sql, shared, structure
|
||||||
# + vectors_to_send
|
# + vectors_to_send
|
||||||
|
|
||||||
|
|
||||||
class TestObjectsSQL(unittest.TestCase):
|
class TestObjects():
|
||||||
"""A test case for the sqlite inventory"""
|
"""
|
||||||
|
A base class for the test case for shared.objects,
|
||||||
@classmethod
|
containing tests for all the methods directly used in code.
|
||||||
def setUpClass(cls):
|
"""
|
||||||
shared.data_directory = tempfile.gettempdir()
|
# pylint: disable=no-member
|
||||||
cls.tearDownClass()
|
# A possibility of abstract test cases was rejected:
|
||||||
cls.objects = sql.Inventory()
|
# https://bugs.python.org/issue17519
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls):
|
|
||||||
cls.objects = None
|
|
||||||
os.remove(os.path.join(shared.data_directory, 'objects.dat'))
|
|
||||||
|
|
||||||
def test_set_get(self):
|
def test_set_get(self):
|
||||||
"""Put some objects and check presence and getting"""
|
"""Put some objects and check presence and getting"""
|
||||||
|
@ -151,3 +146,18 @@ class TestObjectsSQL(unittest.TestCase):
|
||||||
pending.add(obj.vector)
|
pending.add(obj.vector)
|
||||||
|
|
||||||
self.assertEqual(self.objects.select(questionable), pending)
|
self.assertEqual(self.objects.select(questionable), pending)
|
||||||
|
|
||||||
|
|
||||||
|
class TestObjectsSQL(TestObjects, unittest.TestCase):
|
||||||
|
"""A test case for the sqlite inventory"""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
shared.data_directory = tempfile.gettempdir()
|
||||||
|
cls.tearDownClass()
|
||||||
|
cls.objects = sql.Inventory()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
cls.objects = None
|
||||||
|
os.remove(os.path.join(shared.data_directory, 'objects.dat'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user