Commit 5ba54d6b authored by Vincent Pelletier's avatar Vincent Pelletier

Move test name display to setUp method, out of runner.

There is no reason why we wouldn't see this when runing individual
tests, I think.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2392 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0961f1bd
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os import os
import sys
import random import random
import unittest import unittest
import tempfile import tempfile
...@@ -33,6 +34,17 @@ DB_PASSWD = os.getenv('NEO_DB_PASSWD', None) ...@@ -33,6 +34,17 @@ DB_PASSWD = os.getenv('NEO_DB_PASSWD', None)
DB_USER = os.getenv('NEO_DB_USER', 'test') DB_USER = os.getenv('NEO_DB_USER', 'test')
class NeoTestBase(unittest.TestCase): class NeoTestBase(unittest.TestCase):
def setUp(self):
sys.stdout.write(' * %s ' % (self.id(), ))
sys.stdout.flush()
unittest.TestCase.setUp(self)
def tearDown(self):
unittest.TestCase.tearDown(self)
sys.stdout.write('\n')
sys.stdout.flush()
class NeoUnitTestBase(NeoTestBase):
""" Base class for neo tests, implements common checks """ """ Base class for neo tests, implements common checks """
def prepareDatabase(self, number, admin=DB_ADMIN, password=DB_PASSWD, def prepareDatabase(self, number, admin=DB_ADMIN, password=DB_PASSWD,
......
...@@ -20,7 +20,7 @@ import unittest ...@@ -20,7 +20,7 @@ import unittest
from cPickle import dumps from cPickle import dumps
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from ZODB.POSException import StorageTransactionError, UndoError, ConflictError from ZODB.POSException import StorageTransactionError, UndoError, ConflictError
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.client.app import Application from neo.client.app import Application
from neo.client.exception import NEOStorageError, NEOStorageNotFoundError from neo.client.exception import NEOStorageError, NEOStorageNotFoundError
from neo.client.exception import NEOStorageDoesNotExistError from neo.client.exception import NEOStorageDoesNotExistError
...@@ -57,7 +57,7 @@ def resolving_tryToResolveConflict(oid, conflict_serial, serial, data): ...@@ -57,7 +57,7 @@ def resolving_tryToResolveConflict(oid, conflict_serial, serial, data):
def failing_tryToResolveConflict(oid, conflict_serial, serial, data): def failing_tryToResolveConflict(oid, conflict_serial, serial, data):
return None return None
class ClientApplicationTests(NeoTestBase): class ClientApplicationTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# apply monkey patches # apply monkey patches
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.client.app import ConnectionPool from neo.client.app import ConnectionPool
class ConnectionPoolTests(NeoTestBase): class ConnectionPoolTests(NeoUnitTestBase):
def test_removeConnection(self): def test_removeConnection(self):
app = None app = None
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import unittest import unittest
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.pt import PartitionTable from neo.pt import PartitionTable
from neo.protocol import NodeTypes, NodeStates from neo.protocol import NodeTypes, NodeStates
from neo.client.handlers.master import PrimaryBootstrapHandler from neo.client.handlers.master import PrimaryBootstrapHandler
...@@ -28,7 +28,7 @@ from neo.client.exception import NEOStorageError ...@@ -28,7 +28,7 @@ from neo.client.exception import NEOStorageError
MARKER = [] MARKER = []
class MasterHandlerTests(NeoTestBase): class MasterHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
pass pass
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, LockState from neo.protocol import NodeTypes, LockState
from neo.client.handlers.storage import StorageBootstrapHandler, \ from neo.client.handlers.storage import StorageBootstrapHandler, \
StorageAnswersHandler StorageAnswersHandler
...@@ -27,7 +27,7 @@ from ZODB.POSException import ConflictError ...@@ -27,7 +27,7 @@ from ZODB.POSException import ConflictError
MARKER = [] MARKER = []
class StorageBootstrapHandlerTests(NeoTestBase): class StorageBootstrapHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.app = Mock() self.app = Mock()
...@@ -64,7 +64,7 @@ class StorageBootstrapHandlerTests(NeoTestBase): ...@@ -64,7 +64,7 @@ class StorageBootstrapHandlerTests(NeoTestBase):
self.checkUUIDSet(conn, uuid) self.checkUUIDSet(conn, uuid)
class StorageAnswerHandlerTests(NeoTestBase): class StorageAnswerHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.app = Mock() self.app = Mock()
......
...@@ -31,7 +31,7 @@ import threading ...@@ -31,7 +31,7 @@ import threading
from neo.neoctl.neoctl import NeoCTL, NotReadyException from neo.neoctl.neoctl import NeoCTL, NotReadyException
from neo.protocol import ClusterStates, NodeTypes, CellStates, NodeStates from neo.protocol import ClusterStates, NodeTypes, CellStates, NodeStates
from neo.util import dump from neo.util import dump
from neo.tests import DB_ADMIN, DB_PASSWD from neo.tests import DB_ADMIN, DB_PASSWD, NeoTestBase
from neo.client.Storage import Storage from neo.client.Storage import Storage
NEO_MASTER = 'neomaster' NEO_MASTER = 'neomaster'
...@@ -538,13 +538,14 @@ class NEOCluster(object): ...@@ -538,13 +538,14 @@ class NEOCluster(object):
os.removedirs(self.temp_dir) os.removedirs(self.temp_dir)
class NEOFunctionalTest(unittest.TestCase): class NEOFunctionalTest(NeoTestBase):
def getTempDirectory(self): def getTempDirectory(self):
# get the current temp directory or a new one # get the current temp directory or a new one
temp_dir = os.environ.get('TEMP', None) temp_dir = os.environ.get('TEMP', None)
if temp_dir is None: if temp_dir is None:
temp_dir = tempfile.mkdtemp(prefix='neo_') temp_dir = tempfile.mkdtemp(prefix='neo_')
os.environ['TEMP'] = temp_dir
print 'Using temp directory %r.' % (temp_dir, ) print 'Using temp directory %r.' % (temp_dir, )
# build the full path based on test case and current test method # build the full path based on test case and current test method
temp_dir = os.path.join(temp_dir, self.id()) temp_dir = os.path.join(temp_dir, self.id())
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
import unittest import unittest
from mock import Mock from mock import Mock
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates, Packets from neo.protocol import NodeTypes, NodeStates, Packets
from neo.master.handlers.client import ClientServiceHandler from neo.master.handlers.client import ClientServiceHandler
from neo.master.app import Application from neo.master.app import Application
class MasterClientHandlerTests(NeoTestBase): class MasterClientHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# create an application object # create an application object
...@@ -47,7 +47,7 @@ class MasterClientHandlerTests(NeoTestBase): ...@@ -47,7 +47,7 @@ class MasterClientHandlerTests(NeoTestBase):
self.app.nm.createStorage(**kw) self.app.nm.createStorage(**kw)
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def getLastUUID(self): def getLastUUID(self):
return self.uuid return self.uuid
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo import protocol from neo import protocol
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import Packet, NodeTypes, NodeStates from neo.protocol import Packet, NodeTypes, NodeStates
from neo.master.handlers.election import ClientElectionHandler, ServerElectionHandler from neo.master.handlers.election import ClientElectionHandler, ServerElectionHandler
from neo.master.app import Application from neo.master.app import Application
...@@ -31,7 +31,7 @@ def _addPacket(self, packet): ...@@ -31,7 +31,7 @@ def _addPacket(self, packet):
if self.connector is not None: if self.connector is not None:
self.connector._addPacket(packet) self.connector._addPacket(packet)
class MasterClientElectionTests(NeoTestBase): class MasterClientElectionTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# create an application object # create an application object
...@@ -57,7 +57,7 @@ class MasterClientElectionTests(NeoTestBase): ...@@ -57,7 +57,7 @@ class MasterClientElectionTests(NeoTestBase):
def tearDown(self): def tearDown(self):
# restore patched methods # restore patched methods
ClientConnection._addPacket = self._addPacket ClientConnection._addPacket = self._addPacket
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def identifyToMasterNode(self): def identifyToMasterNode(self):
node = self.app.nm.getMasterList()[0] node = self.app.nm.getMasterList()[0]
...@@ -189,7 +189,7 @@ class MasterClientElectionTests(NeoTestBase): ...@@ -189,7 +189,7 @@ class MasterClientElectionTests(NeoTestBase):
self.checkRequestIdentification(conn) self.checkRequestIdentification(conn)
class MasterServerElectionTests(NeoTestBase): class MasterServerElectionTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# create an application object # create an application object
...@@ -213,7 +213,7 @@ class MasterServerElectionTests(NeoTestBase): ...@@ -213,7 +213,7 @@ class MasterServerElectionTests(NeoTestBase):
ClientConnection._addPacket = _addPacket ClientConnection._addPacket = _addPacket
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
# restore environnement # restore environnement
ClientConnection._addPacket = self._addPacket ClientConnection._addPacket = self._addPacket
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.master.app import Application from neo.master.app import Application
from neo.util import p64, u64 from neo.util import p64, u64
class MasterAppTests(NeoTestBase): class MasterAppTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# create an application object # create an application object
...@@ -30,7 +30,7 @@ class MasterAppTests(NeoTestBase): ...@@ -30,7 +30,7 @@ class MasterAppTests(NeoTestBase):
self.app.pt.clear() self.app.pt.clear()
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def test_06_broadcastNodeInformation(self): def test_06_broadcastNodeInformation(self):
# defined some nodes to which data will be send # defined some nodes to which data will be send
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeStates, CellStates from neo.protocol import NodeStates, CellStates
from neo.master.pt import PartitionTable from neo.master.pt import PartitionTable
from neo.node import StorageNode from neo.node import StorageNode
class MasterPartitionTableTests(NeoTestBase): class MasterPartitionTableTests(NeoUnitTestBase):
def test_02_PartitionTable_creation(self): def test_02_PartitionTable_creation(self):
num_partitions = 5 num_partitions = 5
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
import unittest import unittest
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates, CellStates from neo.protocol import NodeTypes, NodeStates, CellStates
from neo.master.recovery import RecoveryManager from neo.master.recovery import RecoveryManager
from neo.master.app import Application from neo.master.app import Application
class MasterRecoveryTests(NeoTestBase): class MasterRecoveryTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# create an application object # create an application object
...@@ -44,7 +44,7 @@ class MasterRecoveryTests(NeoTestBase): ...@@ -44,7 +44,7 @@ class MasterRecoveryTests(NeoTestBase):
self.storage_address = ('127.0.0.1', self.storage_port) self.storage_address = ('127.0.0.1', self.storage_port)
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
# Common methods # Common methods
def getLastUUID(self): def getLastUUID(self):
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
import unittest import unittest
from mock import Mock from mock import Mock
from struct import pack from struct import pack
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates, Packets from neo.protocol import NodeTypes, NodeStates, Packets
from neo.master.handlers.storage import StorageServiceHandler from neo.master.handlers.storage import StorageServiceHandler
from neo.master.handlers.client import ClientServiceHandler from neo.master.handlers.client import ClientServiceHandler
from neo.master.app import Application from neo.master.app import Application
from neo.exception import OperationFailure from neo.exception import OperationFailure
class MasterStorageHandlerTests(NeoTestBase): class MasterStorageHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# create an application object # create an application object
...@@ -44,7 +44,7 @@ class MasterStorageHandlerTests(NeoTestBase): ...@@ -44,7 +44,7 @@ class MasterStorageHandlerTests(NeoTestBase):
self.storage_address = ('127.0.0.1', self.storage_port) self.storage_address = ('127.0.0.1', self.storage_port)
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def _allocatePort(self): def _allocatePort(self):
self.port = getattr(self, 'port', 1000) + 1 self.port = getattr(self, 'port', 1000) + 1
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
import unittest import unittest
from mock import Mock from mock import Mock
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.master.transactions import Transaction, TransactionManager from neo.master.transactions import Transaction, TransactionManager
class testTransactionManager(NeoTestBase): class testTransactionManager(NeoUnitTestBase):
def makeTID(self, i): def makeTID(self, i):
return pack('!Q', i) return pack('!Q', i)
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
import unittest import unittest
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates from neo.protocol import NodeTypes, NodeStates
from neo.master.verification import VerificationManager, VerificationFailure from neo.master.verification import VerificationManager, VerificationFailure
from neo.master.app import Application from neo.master.app import Application
class MasterVerificationTests(NeoTestBase): class MasterVerificationTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
# create an application object # create an application object
...@@ -45,7 +45,7 @@ class MasterVerificationTests(NeoTestBase): ...@@ -45,7 +45,7 @@ class MasterVerificationTests(NeoTestBase):
self.storage_address = ('127.0.0.1', self.storage_port) self.storage_address = ('127.0.0.1', self.storage_port)
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
# Common methods # Common methods
def getLastUUID(self): def getLastUUID(self):
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import unittest import unittest
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from collections import deque from collections import deque
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.transactions import ConflictError, DelayedError from neo.storage.transactions import ConflictError, DelayedError
from neo.storage.handlers.client import ClientOperationHandler from neo.storage.handlers.client import ClientOperationHandler
...@@ -26,7 +26,7 @@ from neo.protocol import INVALID_PARTITION ...@@ -26,7 +26,7 @@ from neo.protocol import INVALID_PARTITION
from neo.protocol import INVALID_TID, INVALID_OID, INVALID_SERIAL from neo.protocol import INVALID_TID, INVALID_OID, INVALID_SERIAL
from neo.protocol import Packets, LockState from neo.protocol import Packets, LockState
class StorageClientHandlerTests(NeoTestBase): class StorageClientHandlerTests(NeoUnitTestBase):
def checkHandleUnexpectedPacket(self, _call, _msg_type, _listening=True, **kwargs): def checkHandleUnexpectedPacket(self, _call, _msg_type, _listening=True, **kwargs):
conn = self.getFakeConnection(address=("127.0.0.1", self.master_port), conn = self.getFakeConnection(address=("127.0.0.1", self.master_port),
...@@ -55,7 +55,7 @@ class StorageClientHandlerTests(NeoTestBase): ...@@ -55,7 +55,7 @@ class StorageClientHandlerTests(NeoTestBase):
self.master_port = 10010 self.master_port = 10010
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def _getConnection(self, uuid=None): def _getConnection(self, uuid=None):
return self.getFakeConnection(uuid=uuid, address=('127.0.0.1', 1000)) return self.getFakeConnection(uuid=uuid, address=('127.0.0.1', 1000))
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NotReadyError, BrokenNodeDisallowedError from neo.protocol import NodeTypes, NotReadyError, BrokenNodeDisallowedError
from neo.pt import PartitionTable from neo.pt import PartitionTable
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.identification import IdentificationHandler from neo.storage.handlers.identification import IdentificationHandler
class StorageIdentificationHandlerTests(NeoTestBase): class StorageIdentificationHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
config = self.getStorageConfiguration(master_number=1) config = self.getStorageConfiguration(master_number=1)
......
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.pt import PartitionTable from neo.pt import PartitionTable
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.initialization import InitializationHandler from neo.storage.handlers.initialization import InitializationHandler
from neo.protocol import CellStates, ProtocolError from neo.protocol import CellStates, ProtocolError
from neo.exception import PrimaryFailure from neo.exception import PrimaryFailure
class StorageInitializationHandlerTests(NeoTestBase): class StorageInitializationHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.prepareDatabase(number=1) self.prepareDatabase(number=1)
...@@ -43,7 +43,7 @@ class StorageInitializationHandlerTests(NeoTestBase): ...@@ -43,7 +43,7 @@ class StorageInitializationHandlerTests(NeoTestBase):
self.app.pt = PartitionTable(self.num_partitions, self.num_replicas) self.app.pt = PartitionTable(self.num_partitions, self.num_replicas)
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
# Common methods # Common methods
def getLastUUID(self): def getLastUUID(self):
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import unittest import unittest
from mock import Mock from mock import Mock
from collections import deque from collections import deque
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.master import MasterOperationHandler from neo.storage.handlers.master import MasterOperationHandler
from neo.exception import PrimaryFailure, OperationFailure from neo.exception import PrimaryFailure, OperationFailure
...@@ -26,7 +26,7 @@ from neo.pt import PartitionTable ...@@ -26,7 +26,7 @@ from neo.pt import PartitionTable
from neo.protocol import CellStates, ProtocolError, Packets from neo.protocol import CellStates, ProtocolError, Packets
from neo.protocol import INVALID_TID, INVALID_OID from neo.protocol import INVALID_TID, INVALID_OID
class StorageMasterHandlerTests(NeoTestBase): class StorageMasterHandlerTests(NeoUnitTestBase):
def checkHandleUnexpectedPacket(self, _call, _msg_type, _listening=True, **kwargs): def checkHandleUnexpectedPacket(self, _call, _msg_type, _listening=True, **kwargs):
conn = self.getMasterConnection(is_server=_listening) conn = self.getMasterConnection(is_server=_listening)
...@@ -53,7 +53,7 @@ class StorageMasterHandlerTests(NeoTestBase): ...@@ -53,7 +53,7 @@ class StorageMasterHandlerTests(NeoTestBase):
self.master_port = 10010 self.master_port = 10010
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def getMasterConnection(self): def getMasterConnection(self):
address = ("127.0.0.1", self.master_port) address = ("127.0.0.1", self.master_port)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import Packets, ZERO_OID, ZERO_TID from neo.protocol import Packets, ZERO_OID, ZERO_TID
from neo.storage.handlers.replication import ReplicationHandler, add64 from neo.storage.handlers.replication import ReplicationHandler, add64
from neo.storage.handlers.replication import RANGE_LENGTH, MIN_RANGE_LENGTH from neo.storage.handlers.replication import RANGE_LENGTH, MIN_RANGE_LENGTH
...@@ -58,7 +58,7 @@ class FakeDict(object): ...@@ -58,7 +58,7 @@ class FakeDict(object):
def __len__(self): def __len__(self):
return len(self._dict) return len(self._dict)
class StorageReplicationHandlerTests(NeoTestBase): class StorageReplicationHandlerTests(NeoUnitTestBase):
def setup(self): def setup(self):
pass pass
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
import unittest import unittest
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.storage.replicator import Replicator, Partition, Task from neo.storage.replicator import Replicator, Partition, Task
from neo.protocol import CellStates, NodeStates, Packets from neo.protocol import CellStates, NodeStates, Packets
class StorageReplicatorTests(NeoTestBase): class StorageReplicatorTests(NeoUnitTestBase):
def setup(self): def setup(self):
pass pass
......
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.protocol import CellStates from neo.protocol import CellStates
from collections import deque from collections import deque
from neo.pt import PartitionTable from neo.pt import PartitionTable
from neo.util import dump from neo.util import dump
class StorageAppTests(NeoTestBase): class StorageAppTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.prepareDatabase(number=1) self.prepareDatabase(number=1)
...@@ -34,7 +34,7 @@ class StorageAppTests(NeoTestBase): ...@@ -34,7 +34,7 @@ class StorageAppTests(NeoTestBase):
self.app.event_queue = deque() self.app.event_queue = deque()
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def test_01_loadPartitionTable(self): def test_01_loadPartitionTable(self):
self.app.dm = Mock({ self.app.dm = Mock({
......
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
import unittest import unittest
from mock import Mock from mock import Mock
from collections import deque from collections import deque
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.storage import StorageOperationHandler from neo.storage.handlers.storage import StorageOperationHandler
from neo.protocol import INVALID_PARTITION, Packets from neo.protocol import INVALID_PARTITION, Packets
from neo.protocol import INVALID_TID, INVALID_OID, INVALID_SERIAL from neo.protocol import INVALID_TID, INVALID_OID, INVALID_SERIAL
class StorageStorageHandlerTests(NeoTestBase): class StorageStorageHandlerTests(NeoUnitTestBase):
def checkHandleUnexpectedPacket(self, _call, _msg_type, _listening=True, **kwargs): def checkHandleUnexpectedPacket(self, _call, _msg_type, _listening=True, **kwargs):
conn = self.getFakeConnection(address=("127.0.0.1", self.master_port), conn = self.getFakeConnection(address=("127.0.0.1", self.master_port),
...@@ -52,7 +52,7 @@ class StorageStorageHandlerTests(NeoTestBase): ...@@ -52,7 +52,7 @@ class StorageStorageHandlerTests(NeoTestBase):
self.master_port = 10010 self.master_port = 10010
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
def test_18_askTransactionInformation1(self): def test_18_askTransactionInformation1(self):
# transaction does not exists # transaction does not exists
......
...@@ -20,14 +20,14 @@ import MySQLdb ...@@ -20,14 +20,14 @@ import MySQLdb
from mock import Mock from mock import Mock
from neo.util import dump, p64, u64 from neo.util import dump, p64, u64
from neo.protocol import CellStates, ZERO_OID, ZERO_TID, MAX_TID from neo.protocol import CellStates, ZERO_OID, ZERO_TID, MAX_TID
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.exception import DatabaseFailure from neo.exception import DatabaseFailure
from neo.storage.database.mysqldb import MySQLDatabaseManager from neo.storage.database.mysqldb import MySQLDatabaseManager
NEO_SQL_DATABASE = 'test_mysqldb0' NEO_SQL_DATABASE = 'test_mysqldb0'
NEO_SQL_USER = 'test' NEO_SQL_USER = 'test'
class StorageMySQSLdbTests(NeoTestBase): class StorageMySQSLdbTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.prepareDatabase(number=1, prefix=NEO_SQL_DATABASE[:-1]) self.prepareDatabase(number=1, prefix=NEO_SQL_DATABASE[:-1])
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.storage.transactions import Transaction, TransactionManager from neo.storage.transactions import Transaction, TransactionManager
from neo.storage.transactions import ConflictError, DelayedError from neo.storage.transactions import ConflictError, DelayedError
class TransactionTests(NeoTestBase): class TransactionTests(NeoUnitTestBase):
def testInit(self): def testInit(self):
uuid = self.getNewUUID() uuid = self.getNewUUID()
...@@ -79,7 +79,7 @@ class TransactionTests(NeoTestBase): ...@@ -79,7 +79,7 @@ class TransactionTests(NeoTestBase):
self.assertEqual(txn.getObject(oid_2), None) self.assertEqual(txn.getObject(oid_2), None)
self.assertEqual(txn.getObject(oid_1), object_info) self.assertEqual(txn.getObject(oid_1), object_info)
class TransactionManagerTests(NeoTestBase): class TransactionManagerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.app = Mock() self.app = Mock()
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.pt import PartitionTable from neo.pt import PartitionTable
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.verification import VerificationHandler from neo.storage.handlers.verification import VerificationHandler
...@@ -26,7 +26,7 @@ from neo.protocol import INVALID_OID, INVALID_TID ...@@ -26,7 +26,7 @@ from neo.protocol import INVALID_OID, INVALID_TID
from neo.exception import PrimaryFailure, OperationFailure from neo.exception import PrimaryFailure, OperationFailure
from neo.util import p64, u64 from neo.util import p64, u64
class StorageVerificationHandlerTests(NeoTestBase): class StorageVerificationHandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.prepareDatabase(number=1) self.prepareDatabase(number=1)
...@@ -46,7 +46,7 @@ class StorageVerificationHandlerTests(NeoTestBase): ...@@ -46,7 +46,7 @@ class StorageVerificationHandlerTests(NeoTestBase):
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
# Common methods # Common methods
def getLastUUID(self): def getLastUUID(self):
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.bootstrap import BootstrapManager from neo.bootstrap import BootstrapManager
from neo.protocol import NodeTypes from neo.protocol import NodeTypes
class BootstrapManagerTests(NeoTestBase): class BootstrapManagerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.prepareDatabase(number=1) self.prepareDatabase(number=1)
...@@ -37,7 +37,7 @@ class BootstrapManagerTests(NeoTestBase): ...@@ -37,7 +37,7 @@ class BootstrapManagerTests(NeoTestBase):
self.num_replicas = 2 self.num_replicas = 2
def tearDown(self): def tearDown(self):
NeoTestBase.tearDown(self) NeoUnitTestBase.tearDown(self)
# Common methods # Common methods
def getLastUUID(self): def getLastUUID(self):
......
...@@ -25,11 +25,11 @@ from neo.tests import DoNothingConnector ...@@ -25,11 +25,11 @@ from neo.tests import DoNothingConnector
from neo.connector import ConnectorException, ConnectorTryAgainException, \ from neo.connector import ConnectorException, ConnectorTryAgainException, \
ConnectorInProgressException, ConnectorConnectionRefusedException ConnectorInProgressException, ConnectorConnectionRefusedException
from neo.protocol import Packets, ParserState from neo.protocol import Packets, ParserState
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.util import ReadBuffer from neo.util import ReadBuffer
from neo.locking import Queue from neo.locking import Queue
class ConnectionTests(NeoTestBase): class ConnectionTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.app = Mock({'__repr__': 'Fake App'}) self.app = Mock({'__repr__': 'Fake App'})
...@@ -834,7 +834,7 @@ class MTConnectionTests(ConnectionTests): ...@@ -834,7 +834,7 @@ class MTConnectionTests(ConnectionTests):
# ... except Ping # ... except Ping
ask(Packets.Ping()) ask(Packets.Ping())
class HandlerSwitcherTests(NeoTestBase): class HandlerSwitcherTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self._handler = handler = Mock({ self._handler = handler = Mock({
...@@ -1088,7 +1088,7 @@ class HandlerSwitcherTests(NeoTestBase): ...@@ -1088,7 +1088,7 @@ class HandlerSwitcherTests(NeoTestBase):
# ...with expected parameters # ...with expected parameters
self.assertEqual(markers[0], (4, self._connection, msg_id_4)) self.assertEqual(markers[0], (4, self._connection, msg_id_4))
class TestTimeout(NeoTestBase): class TestTimeout(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.current = time() self.current = time()
self.timeout = Timeout() self.timeout = Timeout()
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
import unittest import unittest
from mock import Mock from mock import Mock
from time import time from time import time
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.epoll import Epoll from neo.epoll import Epoll
from neo.event import EpollEventManager from neo.event import EpollEventManager
class EventTests(NeoTestBase): class EventTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
pass pass
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.handler import EventHandler from neo.handler import EventHandler
from neo.protocol import PacketMalformedError, UnexpectedPacketError, \ from neo.protocol import PacketMalformedError, UnexpectedPacketError, \
BrokenNodeDisallowedError, NotReadyError, ProtocolError BrokenNodeDisallowedError, NotReadyError, ProtocolError
class HandlerTests(NeoTestBase): class HandlerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
app = Mock() app = Mock()
......
...@@ -21,10 +21,10 @@ from neo import protocol ...@@ -21,10 +21,10 @@ from neo import protocol
from neo.protocol import NodeTypes, NodeStates from neo.protocol import NodeTypes, NodeStates
from neo.node import Node, MasterNode, StorageNode, ClientNode, AdminNode, \ from neo.node import Node, MasterNode, StorageNode, ClientNode, AdminNode, \
NodeManager NodeManager
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from time import time from time import time
class NodesTests(NeoTestBase): class NodesTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.manager = Mock() self.manager = Mock()
...@@ -122,7 +122,7 @@ class NodesTests(NeoTestBase): ...@@ -122,7 +122,7 @@ class NodesTests(NeoTestBase):
self.assertFalse(node.isClient()) self.assertFalse(node.isClient())
class NodeManagerTests(NeoTestBase): class NodeManagerTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.manager = NodeManager() self.manager = NodeManager()
......
...@@ -20,9 +20,9 @@ from mock import Mock ...@@ -20,9 +20,9 @@ from mock import Mock
from neo.protocol import NodeStates, CellStates from neo.protocol import NodeStates, CellStates
from neo.pt import Cell, PartitionTable from neo.pt import Cell, PartitionTable
from neo.node import StorageNode from neo.node import StorageNode
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
class PartitionTableTests(NeoTestBase): class PartitionTableTests(NeoUnitTestBase):
def test_01_Cell(self): def test_01_Cell(self):
uuid = self.getNewUUID() uuid = self.getNewUUID()
......
...@@ -19,9 +19,9 @@ import unittest ...@@ -19,9 +19,9 @@ import unittest
from neo.protocol import NodeTypes, NodeStates, CellStates, ClusterStates from neo.protocol import NodeTypes, NodeStates, CellStates, ClusterStates
from neo.protocol import ErrorCodes, Packets, Errors, LockState from neo.protocol import ErrorCodes, Packets, Errors, LockState
from neo.protocol import INVALID_TID from neo.protocol import INVALID_TID
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
class ProtocolTests(NeoTestBase): class ProtocolTests(NeoUnitTestBase):
def setUp(self): def setUp(self):
self.ltid = None self.ltid = None
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
import unittest import unittest
from neo.tests import NeoTestBase from neo.tests import NeoUnitTestBase
from neo.util import ReadBuffer from neo.util import ReadBuffer
class UtilTests(NeoTestBase): class UtilTests(NeoUnitTestBase):
def testReadBufferRead(self): def testReadBufferRead(self):
""" Append some chunk then consume the data """ """ Append some chunk then consume the data """
......
...@@ -152,10 +152,6 @@ class NeoTestRunner(unittest.TestResult): ...@@ -152,10 +152,6 @@ class NeoTestRunner(unittest.TestResult):
stats.time += time.time() - self.lastStart stats.time += time.time() - self.lastStart
def startTest(self, test): def startTest(self, test):
module = test.__class__.__name__
method = test.id()
sys.stdout.write(' * %s ' % (method, ))
sys.stdout.flush()
unittest.TestResult.startTest(self, test) unittest.TestResult.startTest(self, test)
logging.info(" * TEST %s" % test) logging.info(" * TEST %s" % test)
stats = self._getModuleStats(test) stats = self._getModuleStats(test)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment