refactor(tests): use __test__ pattern instead of class in class
@@ -45,8 +45,9 @@ else:
settings = HathorSettings()
-class _BaseTransactionStorageTest:
- class _TransactionStorageTest(unittest.TestCase):
+class BaseTransactionStorageTest(unittest.TestCase):
+ __test__ = False
+
def setUp(self, tx_storage, reactor=None):
from hathor.manager import HathorManager
@@ -424,7 +425,9 @@ class _BaseTransactionStorageTest:
self.assertIsNone(self.tx_storage.get_value(attr))
-class TransactionBinaryStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class TransactionBinaryStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
self.directory = tempfile.mkdtemp()
super().setUp(TransactionBinaryStorage(self.directory))
@@ -434,7 +437,9 @@ class TransactionBinaryStorageTest(_BaseTransactionStorageTest._TransactionStora
super().tearDown()
-class TransactionCompactStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class TransactionCompactStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
self.directory = tempfile.mkdtemp()
# Creating random file just to test specific part of code
@@ -452,7 +457,9 @@ class TransactionCompactStorageTest(_BaseTransactionStorageTest._TransactionStor
super().tearDown()
-class CacheBinaryStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class CacheBinaryStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
self.directory = tempfile.mkdtemp()
store = TransactionBinaryStorage(self.directory)
@@ -464,7 +471,9 @@ class CacheBinaryStorageTest(_BaseTransactionStorageTest._TransactionStorageTest
super().tearDown()
-class CacheCompactStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class CacheCompactStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
self.directory = tempfile.mkdtemp()
# Creating random file just to test specific part of code
@@ -478,12 +487,16 @@ class CacheCompactStorageTest(_BaseTransactionStorageTest._TransactionStorageTes
super().tearDown()
-class TransactionMemoryStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class TransactionMemoryStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
super().setUp(TransactionMemoryStorage())
-class CacheMemoryStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class CacheMemoryStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
store = TransactionMemoryStorage()
reactor = Clock()
@@ -491,7 +504,9 @@ class CacheMemoryStorageTest(_BaseTransactionStorageTest._TransactionStorageTest
@pytest.mark.skipif(not HAS_ROCKSDB, reason='requires python-rocksdb')
-class TransactionOldRocksDBStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class TransactionOldRocksDBStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
self.directory = tempfile.mkdtemp()
super().setUp(TransactionOldRocksDBStorage(self.directory))
@@ -502,7 +517,9 @@ class TransactionOldRocksDBStorageTest(_BaseTransactionStorageTest._TransactionS
@pytest.mark.skipif(not HAS_ROCKSDB, reason='requires python-rocksdb')
-class TransactionRocksDBStorageTest(_BaseTransactionStorageTest._TransactionStorageTest):
+class TransactionRocksDBStorageTest(BaseTransactionStorageTest):
+ __test__ = True
+
def setUp(self):
self.directory = tempfile.mkdtemp()
super().setUp(TransactionRocksDBStorage(self.directory))
