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
|
||||
|
||||
|
||||
class TestObjectsSQL(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'))
|
||||
class TestObjects():
|
||||
"""
|
||||
A base class for the test case for shared.objects,
|
||||
containing tests for all the methods directly used in code.
|
||||
"""
|
||||
# pylint: disable=no-member
|
||||
# A possibility of abstract test cases was rejected:
|
||||
# https://bugs.python.org/issue17519
|
||||
|
||||
def test_set_get(self):
|
||||
"""Put some objects and check presence and getting"""
|
||||
|
@ -151,3 +146,18 @@ class TestObjectsSQL(unittest.TestCase):
|
|||
pending.add(obj.vector)
|
||||
|
||||
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