[Neo-report] r2615 olivier.cros [2/2] - in /trunk: neo/ neo/admin/ neo/client/ neo/client/...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 17 16:25:38 CET 2011


Modified: trunk/neo/storage/app.py
==============================================================================
--- trunk/neo/storage/app.py [iso-8859-1] (original)
+++ trunk/neo/storage/app.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,23 +19,23 @@ import neo
 import sys
 from collections import deque
 
-from neo.protocol import NodeTypes, CellStates, Packets
-from neo.node import NodeManager
-from neo.event import EventManager
-from neo.connection import ListeningConnection
-from neo.exception import OperationFailure, PrimaryFailure
+from neo.lib.protocol import NodeTypes, CellStates, Packets
+from neo.lib.node import NodeManager
+from neo.lib.event import EventManager
+from neo.lib.connection import ListeningConnection
+from neo.lib.exception import OperationFailure, PrimaryFailure
 from neo.storage.handlers import identification, verification, initialization
 from neo.storage.handlers import master, hidden
 from neo.storage.replicator import Replicator
 from neo.storage.database import buildDatabaseManager
 from neo.storage.transactions import TransactionManager
 from neo.storage.exception import AlreadyPendingError
-from neo.connector import getConnectorHandler
-from neo.pt import PartitionTable
-from neo.util import dump
-from neo.bootstrap import BootstrapManager
+from neo.lib.connector import getConnectorHandler
+from neo.lib.pt import PartitionTable
+from neo.lib.util import dump
+from neo.lib.bootstrap import BootstrapManager
 
-from neo.live_debug import register as registerLiveDebugger
+from neo.lib.live_debug import register as registerLiveDebugger
 
 class Application(object):
     """The storage node application."""
@@ -59,7 +59,7 @@ class Application(object):
 
         # set the bind address
         self.server = config.getBind()
-        neo.logging.debug('IP address is %s, port is %d', *(self.server))
+        neo.lib.logging.debug('IP address is %s, port is %d', *(self.server))
 
         # The partition table is initialized after getting the number of
         # partitions.
@@ -131,12 +131,12 @@ class Application(object):
             # create a partition table
             self.pt = PartitionTable(num_partitions, num_replicas)
 
-        neo.logging.info('Configuration loaded:')
-        neo.logging.info('UUID      : %s', dump(self.uuid))
-        neo.logging.info('PTID      : %s', dump(ptid))
-        neo.logging.info('Name      : %s', self.name)
-        neo.logging.info('Partitions: %s', num_partitions)
-        neo.logging.info('Replicas  : %s', num_replicas)
+        neo.lib.logging.info('Configuration loaded:')
+        neo.lib.logging.info('UUID      : %s', dump(self.uuid))
+        neo.lib.logging.info('PTID      : %s', dump(ptid))
+        neo.lib.logging.info('Name      : %s', self.name)
+        neo.lib.logging.info('Partitions: %s', num_partitions)
+        neo.lib.logging.info('Replicas  : %s', num_replicas)
 
     def loadPartitionTable(self):
         """Load a partition table from the database."""
@@ -161,7 +161,7 @@ class Application(object):
         try:
             self._run()
         except:
-            neo.logging.info('\nPre-mortem informations:')
+            neo.lib.logging.info('\nPre-mortem informations:')
             self.log()
             raise
 
@@ -202,10 +202,10 @@ class Application(object):
                 self.doOperation()
                 raise RuntimeError, 'should not reach here'
             except OperationFailure, msg:
-                neo.logging.error('operation stopped: %s', msg)
+                neo.lib.logging.error('operation stopped: %s', msg)
             except PrimaryFailure, msg:
                 self.replicator.masterLost()
-                neo.logging.error('primary master is down: %s', msg)
+                neo.lib.logging.error('primary master is down: %s', msg)
                 self.master_node = None
 
     def connectToPrimary(self):
@@ -230,7 +230,7 @@ class Application(object):
         (node, conn, uuid, num_partitions, num_replicas) = data
         self.master_node = node
         self.master_conn = conn
-        neo.logging.info('I am %s', dump(uuid))
+        neo.lib.logging.info('I am %s', dump(uuid))
         self.uuid = uuid
         self.dm.setUUID(uuid)
 
@@ -252,7 +252,7 @@ class Application(object):
     def verifyData(self):
         """Verify data under the control by a primary master node.
         Connections from client nodes may not be accepted at this stage."""
-        neo.logging.info('verifying data')
+        neo.lib.logging.info('verifying data')
 
         handler = verification.VerificationHandler(self)
         self.master_conn.setHandler(handler)
@@ -263,7 +263,7 @@ class Application(object):
 
     def initialize(self):
         """ Retreive partition table and node informations from the primary """
-        neo.logging.debug('initializing...')
+        neo.lib.logging.debug('initializing...')
         _poll = self._poll
         handler = initialization.InitializationHandler(self)
         self.master_conn.setHandler(handler)
@@ -285,7 +285,7 @@ class Application(object):
 
     def doOperation(self):
         """Handle everything, including replications and transactions."""
-        neo.logging.info('doing operation')
+        neo.lib.logging.info('doing operation')
 
         _poll = self._poll
 
@@ -309,7 +309,7 @@ class Application(object):
 
     def wait(self):
         # change handler
-        neo.logging.info("waiting in hidden state")
+        neo.lib.logging.info("waiting in hidden state")
         _poll = self._poll
         handler = hidden.HiddenHandler(self)
         for conn in self.em.getConnectionList():
@@ -355,9 +355,9 @@ class Application(object):
     def logQueuedEvents(self):
         if self.event_queue is None:
             return
-        neo.logging.info("Pending events:")
+        neo.lib.logging.info("Pending events:")
         for key, event, _msg_id, _conn, args in self.event_queue:
-            neo.logging.info('  %r:%r: %r:%r %r %r', key, event.__name__,
+            neo.lib.logging.info('  %r:%r: %r:%r %r %r', key, event.__name__,
                 _msg_id, _conn, args)
 
     def shutdown(self, erase=False):

Modified: trunk/neo/storage/database/__init__.py
==============================================================================
--- trunk/neo/storage/database/__init__.py [iso-8859-1] (original)
+++ trunk/neo/storage/database/__init__.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-from neo.exception import DatabaseFailure
+from neo.lib.exception import DatabaseFailure
 from neo.storage.database.manager import DatabaseManager
 
 DATABASE_MANAGER_DICT = {}

Modified: trunk/neo/storage/database/btree.py
==============================================================================
--- trunk/neo/storage/database/btree.py [iso-8859-1] (original)
+++ trunk/neo/storage/database/btree.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -21,11 +21,11 @@ Not persistent ! (no data retained after
 """
 
 from BTrees.OOBTree import OOBTree as _OOBTree
-import neo
+import neo.lib
 
 from neo.storage.database import DatabaseManager
-from neo.protocol import CellStates
-from neo import util
+from neo.lib.protocol import CellStates
+from neo.lib import util
 
 # The only purpose of this value (and code using it) is to avoid creating
 # arbitrarily-long lists of values when cleaning up dictionaries.
@@ -266,7 +266,7 @@ class BTreeDatabaseManager(DatabaseManag
         except KeyError:
             raise IndexError(value_serial)
         if value is None:
-            neo.logging.info("Multiple levels of indirection when " \
+            neo.lib.logging.info("Multiple levels of indirection when " \
                 "searching for object data for oid %d at tid %d. This " \
                 "causes suboptimal performance." % (oid, value_serial))
             value_serial, compression, checksum, value = self._getObjectData(
@@ -522,7 +522,7 @@ class BTreeDatabaseManager(DatabaseManag
             raise CreationUndone
         _, _, value, value_serial = self._obj[oid][value_serial]
         if value is None:
-            neo.logging.info("Multiple levels of indirection when " \
+            neo.lib.logging.info("Multiple levels of indirection when " \
                 "searching for object data for oid %d at tid %d. This " \
                 "causes suboptimal performance." % (oid, value_serial))
             length = self._getObjectLength(oid, value_serial)

Modified: trunk/neo/storage/database/manager.py
==============================================================================
--- trunk/neo/storage/database/manager.py [iso-8859-1] (original)
+++ trunk/neo/storage/database/manager.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,8 +15,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-from neo import util
-from neo.exception import DatabaseFailure
+from neo.lib import util
+from neo.lib.exception import DatabaseFailure
 
 class CreationUndone(Exception):
     pass

Modified: trunk/neo/storage/database/mysqldb.py
==============================================================================
--- trunk/neo/storage/database/mysqldb.py [iso-8859-1] (original)
+++ trunk/neo/storage/database/mysqldb.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,15 +18,15 @@
 import MySQLdb
 from MySQLdb import OperationalError
 from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST
-import neo
+import neo.lib
 from array import array
 import string
 
 from neo.storage.database import DatabaseManager
 from neo.storage.database.manager import CreationUndone
-from neo.exception import DatabaseFailure
-from neo.protocol import CellStates, ZERO_OID, ZERO_TID
-from neo import util
+from neo.lib.exception import DatabaseFailure
+from neo.lib.protocol import CellStates, ZERO_OID, ZERO_TID
+from neo.lib import util
 
 LOG_QUERIES = False
 
@@ -68,7 +68,8 @@ class MySQLDatabaseManager(DatabaseManag
         kwd = {'db' : self.db, 'user' : self.user}
         if self.passwd is not None:
             kwd['passwd'] = self.passwd
-        neo.logging.info('connecting to MySQL on the database %s with user %s',
+        neo.lib.logging.info(
+                        'connecting to MySQL on the database %s with user %s',
                      self.db, self.user)
         self.conn = MySQLdb.connect(**kwd)
         self.conn.autocommit(False)
@@ -78,12 +79,12 @@ class MySQLDatabaseManager(DatabaseManag
 
     def _commit(self):
         if LOG_QUERIES:
-            neo.logging.debug('committing...')
+            neo.lib.logging.debug('committing...')
         self.conn.commit()
 
     def _rollback(self):
         if LOG_QUERIES:
-            neo.logging.debug('aborting...')
+            neo.lib.logging.debug('aborting...')
         self.conn.rollback()
 
     def query(self, query):
@@ -97,7 +98,7 @@ class MySQLDatabaseManager(DatabaseManag
                         c = '\\x%02x' % ord(c)
                     printable_char_list.append(c)
                 query_part = ''.join(printable_char_list)
-                neo.logging.debug('querying %s...', query_part)
+                neo.lib.logging.debug('querying %s...', query_part)
 
             conn.query(query)
             r = conn.store_result()
@@ -114,7 +115,7 @@ class MySQLDatabaseManager(DatabaseManag
 
         except OperationalError, m:
             if m[0] in (SERVER_GONE_ERROR, SERVER_LOST):
-                neo.logging.info('the MySQL server is gone; reconnecting')
+                neo.lib.logging.info('the MySQL server is gone; reconnecting')
                 self._connect()
                 return self.query(query)
             raise DatabaseFailure('MySQL error %d: %s' % (m[0], m[1]))
@@ -324,7 +325,7 @@ class MySQLDatabaseManager(DatabaseManag
             })
         compression, checksum, value, next_value_serial = r[0]
         if value is None:
-            neo.logging.info("Multiple levels of indirection when " \
+            neo.lib.logging.info("Multiple levels of indirection when " \
                 "searching for object data for oid %d at tid %d. This " \
                 "causes suboptimal performance." % (oid, value_serial))
             value_serial, compression, checksum, value = self._getObjectData(
@@ -634,7 +635,7 @@ class MySQLDatabaseManager(DatabaseManag
             (self._getPartition(oid), oid, value_serial))
         length, value_serial = r[0]
         if length is None:
-            neo.logging.info("Multiple levels of indirection when " \
+            neo.lib.logging.info("Multiple levels of indirection when " \
                 "searching for object data for oid %d at tid %d. This " \
                 "causes suboptimal performance." % (oid, value_serial))
             length = self._getObjectLength(oid, value_serial)

Modified: trunk/neo/storage/handlers/__init__.py
==============================================================================
--- trunk/neo/storage/handlers/__init__.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/__init__.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,11 +17,11 @@
 
 import neo
 
-from neo.handler import EventHandler
-from neo import protocol
-from neo.util import dump
-from neo.exception import PrimaryFailure, OperationFailure
-from neo.protocol import NodeStates, NodeTypes, Packets, Errors
+from neo.lib.handler import EventHandler
+from neo.lib import protocol
+from neo.lib.util import dump
+from neo.lib.exception import PrimaryFailure, OperationFailure
+from neo.lib.protocol import NodeStates, NodeTypes, Packets, Errors
 
 class BaseMasterHandler(EventHandler):
 
@@ -35,7 +35,7 @@ class BaseMasterHandler(EventHandler):
         raise PrimaryFailure('re-election occurs')
 
     def notifyClusterInformation(self, conn, state):
-        neo.logging.warning('ignoring notify cluster information in %s' %
+        neo.lib.logging.warning('ignoring notify cluster information in %s' %
                 self.__class__.__name__)
 
     def notifyLastOID(self, conn, oid):
@@ -48,7 +48,7 @@ class BaseMasterHandler(EventHandler):
         for node_type, addr, uuid, state in node_list:
             if uuid == self.app.uuid:
                 # This is me, do what the master tell me
-                neo.logging.info("I was told I'm %s" %(state))
+                neo.lib.logging.info("I was told I'm %s" %(state))
                 if state in (NodeStates.DOWN, NodeStates.TEMPORARILY_DOWN,
                         NodeStates.BROKEN):
                     conn.close()
@@ -57,7 +57,8 @@ class BaseMasterHandler(EventHandler):
                 elif state == NodeStates.HIDDEN:
                     raise OperationFailure
             elif node_type == NodeTypes.CLIENT and state != NodeStates.RUNNING:
-                neo.logging.info('Notified of non-running client, abort (%r)',
+                neo.lib.logging.info(
+                                'Notified of non-running client, abort (%r)',
                         dump(uuid))
                 self.app.tm.abortFor(uuid)
 
@@ -86,14 +87,14 @@ class BaseClientAndStorageOperationHandl
             return
         o = self._askObject(oid, serial, tid)
         if o is None:
-            neo.logging.debug('oid = %s does not exist', dump(oid))
+            neo.lib.logging.debug('oid = %s does not exist', dump(oid))
             p = Errors.OidDoesNotExist(dump(oid))
         elif o is False:
-            neo.logging.debug('oid = %s not found', dump(oid))
+            neo.lib.logging.debug('oid = %s not found', dump(oid))
             p = Errors.OidNotFound(dump(oid))
         else:
             serial, next_serial, compression, checksum, data, data_serial = o
-            neo.logging.debug('oid = %s, serial = %s, next_serial = %s',
+            neo.lib.logging.debug('oid = %s, serial = %s, next_serial = %s',
                           dump(oid), dump(serial), dump(next_serial))
             p = Packets.AnswerObject(oid, serial, next_serial,
                 compression, checksum, data, data_serial)

Modified: trunk/neo/storage/handlers/client.py
==============================================================================
--- trunk/neo/storage/handlers/client.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/client.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,10 +15,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import neo
-from neo import protocol
-from neo.util import dump
-from neo.protocol import Packets, LockState, Errors
+import neo.lib
+from neo.lib import protocol
+from neo.lib.util import dump
+from neo.lib.protocol import Packets, LockState, Errors
 from neo.storage.handlers import BaseClientAndStorageOperationHandler
 from neo.storage.transactions import ConflictError, DelayedError
 from neo.storage.exception import AlreadyPendingError
@@ -51,7 +51,7 @@ class ClientOperationHandler(BaseClientA
             data_serial, ttid, unlock, request_time):
         if ttid not in self.app.tm:
             # transaction was aborted, cancel this event
-            neo.logging.info('Forget store of %s:%s by %s delayed by %s',
+            neo.lib.logging.info('Forget store of %s:%s by %s delayed by %s',
                     dump(oid), dump(serial), dump(ttid),
                     dump(self.app.tm.getLockingTID(oid)))
             # send an answer as the client side is waiting for it
@@ -80,7 +80,7 @@ class ClientOperationHandler(BaseClientA
             if SLOW_STORE is not None:
                 duration = time.time() - request_time
                 if duration > SLOW_STORE:
-                    neo.logging.info('StoreObject delay: %.02fs', duration)
+                    neo.lib.logging.info('StoreObject delay: %.02fs', duration)
             conn.answer(Packets.AnswerStoreObject(0, oid, serial))
 
     def askStoreObject(self, conn, oid, serial,
@@ -140,7 +140,8 @@ class ClientOperationHandler(BaseClientA
 
     def askHasLock(self, conn, ttid, oid):
         locking_tid = self.app.tm.getLockingTID(oid)
-        neo.logging.info('%r check lock of %r:%r', conn, dump(ttid), dump(oid))
+        neo.lib.logging.info('%r check lock of %r:%r', conn,
+                        dump(ttid), dump(oid))
         if locking_tid is None:
             state = LockState.NOT_LOCKED
         elif locking_tid is ttid:
@@ -167,7 +168,8 @@ class ClientOperationHandler(BaseClientA
     def _askCheckCurrentSerial(self, conn, ttid, serial, oid, request_time):
         if ttid not in self.app.tm:
             # transaction was aborted, cancel this event
-            neo.logging.info('Forget serial check of %s:%s by %s delayed by '
+            neo.lib.logging.info(
+                'Forget serial check of %s:%s by %s delayed by '
                 '%s', dump(oid), dump(serial), dump(ttid),
                 dump(self.app.tm.getLockingTID(oid)))
             # send an answer as the client side is waiting for it
@@ -190,7 +192,7 @@ class ClientOperationHandler(BaseClientA
             if SLOW_STORE is not None:
                 duration = time.time() - request_time
                 if duration > SLOW_STORE:
-                    neo.logging.info('CheckCurrentSerial delay: %.02fs',
+                    neo.lib.logging.info('CheckCurrentSerial delay: %.02fs',
                         duration)
             conn.answer(Packets.AnswerCheckCurrentSerial(0, oid, serial))
 

Modified: trunk/neo/storage/handlers/hidden.py
==============================================================================
--- trunk/neo/storage/handlers/hidden.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/hidden.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,10 +15,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import neo
+import neo.lib
 
 from neo.storage.handlers import BaseMasterHandler
-from neo.protocol import CellStates
+from neo.lib.protocol import CellStates
 
 class HiddenHandler(BaseMasterHandler):
     """This class implements a generic part of the event handlers."""
@@ -29,7 +29,7 @@ class HiddenHandler(BaseMasterHandler):
         app = self.app
         if ptid <= app.pt.getID():
             # Ignore this packet.
-            neo.logging.debug('ignoring older partition changes')
+            neo.lib.logging.debug('ignoring older partition changes')
             return
 
         # update partition table in memory and the database

Modified: trunk/neo/storage/handlers/identification.py
==============================================================================
--- trunk/neo/storage/handlers/identification.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/identification.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,18 +15,18 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import neo
+import neo.lib
 
-from neo.handler import EventHandler
-from neo.protocol import NodeTypes, Packets, NotReadyError
-from neo.protocol import ProtocolError, BrokenNodeDisallowedError
-from neo.util import dump
+from neo.lib.handler import EventHandler
+from neo.lib.protocol import NodeTypes, Packets, NotReadyError
+from neo.lib.protocol import ProtocolError, BrokenNodeDisallowedError
+from neo.lib.util import dump
 
 class IdentificationHandler(EventHandler):
     """ Handler used for incoming connections during operation state """
 
     def connectionLost(self, conn, new_state):
-        neo.logging.warning('A connection was lost during identification')
+        neo.lib.logging.warning('A connection was lost during identification')
 
     def requestIdentification(self, conn, node_type,
                                         uuid, address, name):
@@ -54,7 +54,7 @@ class IdentificationHandler(EventHandler
             from neo.storage.handlers.storage import StorageOperationHandler
             handler = StorageOperationHandler
             if node is None:
-                neo.logging.error('reject an unknown storage node %s',
+                neo.lib.logging.error('reject an unknown storage node %s',
                     dump(uuid))
                 raise NotReadyError
         else:

Modified: trunk/neo/storage/handlers/initialization.py
==============================================================================
--- trunk/neo/storage/handlers/initialization.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/initialization.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,10 +15,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import neo
+import neo.lib
 
 from neo.storage.handlers import BaseMasterHandler
-from neo import protocol
+from neo.lib import protocol
 
 class InitializationHandler(BaseMasterHandler):
 
@@ -35,7 +35,7 @@ class InitializationHandler(BaseMasterHa
         pt.load(ptid, row_list, self.app.nm)
         if not pt.filled():
             raise protocol.ProtocolError('Partial partition table received')
-        neo.logging.debug('Got the partition table :')
+        neo.lib.logging.debug('Got the partition table :')
         self.app.pt.log()
         # Install the partition table into the database for persistency.
         cell_list = []
@@ -48,7 +48,8 @@ class InitializationHandler(BaseMasterHa
                     unassigned_set.remove(offset)
         # delete objects database
         if unassigned_set:
-            neo.logging.debug('drop data for partitions %r' % unassigned_set)
+            neo.lib.logging.debug(
+                            'drop data for partitions %r' % unassigned_set)
             app.dm.dropPartitions(num_partitions, unassigned_set)
 
         app.dm.setPartitionTable(ptid, cell_list)
@@ -66,5 +67,5 @@ class InitializationHandler(BaseMasterHa
         #   packets in between (or even before asking for node information).
         # - this handler will be changed after receiving answerPartitionTable
         #   and before handling the next packet
-        neo.logging.debug('ignoring notifyPartitionChanges during '\
+        neo.lib.logging.debug('ignoring notifyPartitionChanges during '\
             'initialization')

Modified: trunk/neo/storage/handlers/master.py
==============================================================================
--- trunk/neo/storage/handlers/master.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/master.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,9 +15,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import neo
-from neo.util import dump
-from neo.protocol import CellStates, Packets, ProtocolError
+import neo.lib
+from neo.lib.util import dump
+from neo.lib.protocol import CellStates, Packets, ProtocolError
 from neo.storage.handlers import BaseMasterHandler
 
 
@@ -36,7 +36,7 @@ class MasterOperationHandler(BaseMasterH
         app = self.app
         if ptid <= app.pt.getID():
             # Ignore this packet.
-            neo.logging.debug('ignoring older partition changes')
+            neo.lib.logging.debug('ignoring older partition changes')
             return
 
         # update partition table in memory and the database
@@ -68,9 +68,9 @@ class MasterOperationHandler(BaseMasterH
 
     def askPack(self, conn, tid):
         app = self.app
-        neo.logging.info('Pack started, up to %s...', dump(tid))
+        neo.lib.logging.info('Pack started, up to %s...', dump(tid))
         app.dm.pack(tid, app.tm.updateObjectDataForPack)
-        neo.logging.info('Pack finished.')
+        neo.lib.logging.info('Pack finished.')
         if not conn.isClosed():
             conn.answer(Packets.AnswerPack(True))
 

Modified: trunk/neo/storage/handlers/replication.py
==============================================================================
--- trunk/neo/storage/handlers/replication.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/replication.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -16,11 +16,11 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import neo
+import neo.lib
 
-from neo.handler import EventHandler
-from neo.protocol import Packets, ZERO_TID, ZERO_OID
-from neo.util import add64
+from neo.lib.handler import EventHandler
+from neo.lib.protocol import Packets, ZERO_TID, ZERO_OID
+from neo.lib.util import add64
 
 # TODO: benchmark how different values behave
 RANGE_LENGTH = 4000
@@ -82,11 +82,13 @@ class ReplicationHandler(EventHandler):
     """This class handles events for replications."""
 
     def connectionLost(self, conn, new_state):
-        neo.logging.error('replication is stopped due to a connection lost')
+        neo.lib.logging.error(
+                        'replication is stopped due to a connection lost')
         self.app.replicator.storageLost()
 
     def connectionFailed(self, conn):
-        neo.logging.error('replication is stopped due to connection failure')
+        neo.lib.logging.error(
+                        'replication is stopped due to connection failure')
         self.app.replicator.storageLost()
 
     def acceptIdentification(self, conn, node_type,

Modified: trunk/neo/storage/handlers/storage.py
==============================================================================
--- trunk/neo/storage/handlers/storage.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/storage.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -16,7 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 from neo.storage.handlers import BaseClientAndStorageOperationHandler
-from neo.protocol import Packets
+from neo.lib.protocol import Packets
 
 class StorageOperationHandler(BaseClientAndStorageOperationHandler):
 

Modified: trunk/neo/storage/handlers/verification.py
==============================================================================
--- trunk/neo/storage/handlers/verification.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/verification.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,9 +18,9 @@
 import neo
 
 from neo.storage.handlers import BaseMasterHandler
-from neo.protocol import Packets, Errors, ProtocolError
-from neo.util import dump
-from neo.exception import OperationFailure
+from neo.lib.protocol import Packets, Errors, ProtocolError
+from neo.lib.util import dump
+from neo.lib.exception import OperationFailure
 
 class VerificationHandler(BaseMasterHandler):
     """This class deals with events for a verification phase."""
@@ -48,7 +48,7 @@ class VerificationHandler(BaseMasterHand
         app = self.app
         if ptid <= app.pt.getID():
             # Ignore this packet.
-            neo.logging.debug('ignoring older partition changes')
+            neo.lib.logging.debug('ignoring older partition changes')
             return
         # update partition table in memory and the database
         app.pt.update(ptid, cell_list, app.nm)

Modified: trunk/neo/storage/replicator.py
==============================================================================
--- trunk/neo/storage/replicator.py [iso-8859-1] (original)
+++ trunk/neo/storage/replicator.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -15,13 +15,13 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import neo
+import neo.lib
 from random import choice
 
 from neo.storage.handlers import replication
-from neo.protocol import NodeTypes, NodeStates, Packets
-from neo.connection import ClientConnection
-from neo.util import dump
+from neo.lib.protocol import NodeTypes, NodeStates, Packets
+from neo.lib.connection import ClientConnection
+from neo.lib.util import dump
 
 class Partition(object):
     """This class abstracts the state of a partition."""
@@ -210,7 +210,7 @@ class Replicator(object):
 
     def setCriticalTID(self, tid):
         """This is a callback from MasterOperationHandler."""
-        neo.logging.debug('setting critical TID %s to %s', dump(tid),
+        neo.lib.logging.debug('setting critical TID %s to %s', dump(tid),
             ', '.join([str(p.getRID()) for p in self.critical_tid_list]))
         for partition in self.critical_tid_list:
             partition.setCriticalTID(tid)
@@ -224,7 +224,7 @@ class Replicator(object):
 
     def setUnfinishedTIDList(self, tid_list):
         """This is a callback from MasterOperationHandler."""
-        neo.logging.debug('setting unfinished TIDs %s',
+        neo.lib.logging.debug('setting unfinished TIDs %s',
                       ','.join([dump(tid) for tid in tid_list]))
         self.waiting_for_unfinished_tids = False
         self.unfinished_tid_list = tid_list
@@ -245,13 +245,13 @@ class Replicator(object):
             node = choice(node_list)
         except IndexError:
             # Not operational.
-            neo.logging.error('not operational', exc_info = 1)
+            neo.lib.logging.error('not operational', exc_info = 1)
             self.current_partition = None
             return
 
         addr = node.getAddress()
         if addr is None:
-            neo.logging.error("no address known for the selected node %s" %
+            neo.lib.logging.error("no address known for the selected node %s" %
                     (dump(node.getUUID()), ))
             return
         if self.current_connection is not None:
@@ -299,19 +299,19 @@ class Replicator(object):
             if self.replication_done and \
                     not self.current_connection.isPending():
                 # finish a replication
-                neo.logging.info('replication is done for %s' %
+                neo.lib.logging.info('replication is done for %s' %
                         (self.current_partition.getRID(), ))
                 self._finishReplication()
             return
 
         if self.waiting_for_unfinished_tids:
             # Still waiting.
-            neo.logging.debug('waiting for unfinished tids')
+            neo.lib.logging.debug('waiting for unfinished tids')
             return
 
         if self.unfinished_tid_list is None:
             # Ask pending transactions.
-            neo.logging.debug('asking unfinished tids')
+            neo.lib.logging.debug('asking unfinished tids')
             self._askUnfinishedTIDs()
             return
 
@@ -327,7 +327,7 @@ class Replicator(object):
         else:
             # Not yet.
             self.unfinished_tid_list = None
-            neo.logging.debug('not ready yet')
+            neo.lib.logging.debug('not ready yet')
             return
 
         self._startReplication()

Modified: trunk/neo/storage/transactions.py
==============================================================================
--- trunk/neo/storage/transactions.py [iso-8859-1] (original)
+++ trunk/neo/storage/transactions.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -16,9 +16,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 from time import time
-import neo
-from neo.util import dump
-from neo.protocol import ZERO_TID
+import neo.lib
+from neo.lib.util import dump
+from neo.lib.protocol import ZERO_TID
 
 class ConflictError(Exception):
     """
@@ -228,7 +228,7 @@ class TransactionManager(object):
         # check if the object if locked
         locking_tid = self._store_lock_dict.get(oid)
         if locking_tid == ttid and unlock:
-            neo.logging.info('Deadlock resolution on %r:%r', dump(oid),
+            neo.lib.logging.info('Deadlock resolution on %r:%r', dump(oid),
                 dump(ttid))
             # A duplicate store means client is resolving a deadlock, so
             # drop the lock it held on this object, and drop object data for
@@ -249,7 +249,7 @@ class TransactionManager(object):
                 if previous_serial is None:
                     # XXX: use some special serial when previous store was not
                     # an undo ? Maybe it should just not happen.
-                    neo.logging.info('Transaction %s storing %s more than '
+                    neo.lib.logging.info('Transaction %s storing %s more than '
                         'once', dump(ttid), dump(oid))
             else:
                 previous_serial = None
@@ -258,15 +258,16 @@ class TransactionManager(object):
                 if history_list:
                     previous_serial = history_list[0][0]
             if previous_serial is not None and previous_serial != serial:
-                neo.logging.info('Resolvable conflict on %r:%r', dump(oid),
-                        dump(ttid))
+                neo.lib.logging.info('Resolvable conflict on %r:%r', 
+                    dump(oid), dump(ttid))
                 raise ConflictError(previous_serial)
-            neo.logging.info('Transaction %s storing %s', dump(ttid), dump(oid))
+            neo.lib.logging.info('Transaction %s storing %s',
+                            dump(ttid), dump(oid))
             self._store_lock_dict[oid] = ttid
         elif locking_tid > ttid:
             # We have a smaller TID than locking transaction, so we are older:
             # enter waiting queue so we are handled when lock gets released.
-            neo.logging.info('Store delayed for %r:%r by %r', dump(oid),
+            neo.lib.logging.info('Store delayed for %r:%r by %r', dump(oid),
                     dump(ttid), dump(locking_tid))
             raise DelayedError
         else:
@@ -275,7 +276,7 @@ class TransactionManager(object):
             # hold locks that older transaction is waiting upon. Make client
             # release locks & reacquire them by notifying it of the possible
             # deadlock.
-            neo.logging.info('Possible deadlock on %r:%r with %r',
+            neo.lib.logging.info('Possible deadlock on %r:%r with %r',
                 dump(oid), dump(ttid), dump(locking_tid))
             raise ConflictError(ZERO_TID)
 
@@ -324,7 +325,7 @@ class TransactionManager(object):
                 del self._store_lock_dict[oid]
             except KeyError:
                 # all locks might not have been acquiredwhen aborting
-                neo.logging.warning('%s write lock was not held by %s',
+                neo.lib.logging.warning('%s write lock was not held by %s',
                     dump(oid), dump(ttid))
         # remove the transaction
         uuid = transaction.getUUID()
@@ -352,15 +353,15 @@ class TransactionManager(object):
         return oid in self._load_lock_dict
 
     def log(self):
-        neo.logging.info("Transactions:")
+        neo.lib.logging.info("Transactions:")
         for txn in self._transaction_dict.values():
-            neo.logging.info('    %r', txn)
-        neo.logging.info('  Read locks:')
+            neo.lib.logging.info('    %r', txn)
+        neo.lib.logging.info('  Read locks:')
         for oid, ttid in self._load_lock_dict.items():
-            neo.logging.info('    %r by %r', dump(oid), dump(ttid))
-        neo.logging.info('  Write locks:')
+            neo.lib.logging.info('    %r by %r', dump(oid), dump(ttid))
+        neo.lib.logging.info('  Write locks:')
         for oid, ttid in self._store_lock_dict.items():
-            neo.logging.info('    %r by %r', dump(oid), dump(ttid))
+            neo.lib.logging.info('    %r by %r', dump(oid), dump(ttid))
 
     def updateObjectDataForPack(self, oid, orig_serial, new_serial,
             getObjectData):

Modified: trunk/neo/tests/__init__.py
==============================================================================
--- trunk/neo/tests/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/__init__.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -23,8 +23,8 @@ import tempfile
 import MySQLdb
 import neo
 from mock import Mock
-from neo import protocol
-from neo.protocol import Packets
+from neo.lib import protocol
+from neo.lib.protocol import Packets
 from time import time, gmtime
 from struct import pack, unpack
 
@@ -409,7 +409,7 @@ connector_cpt = 0
 
 class DoNothingConnector(Mock):
     def __init__(self, s=None):
-        neo.logging.info("initializing connector")
+        neo.lib.logging.info("initializing connector")
         self.desc = globals()['connector_cpt']
         globals()['connector_cpt'] = globals()['connector_cpt']+ 1
         self.packet_cpt = 0

Modified: trunk/neo/tests/client/testClientApp.py
==============================================================================
--- trunk/neo/tests/client/testClientApp.py [iso-8859-1] (original)
+++ trunk/neo/tests/client/testClientApp.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -24,8 +24,8 @@ from neo.tests import NeoUnitTestBase
 from neo.client.app import Application, RevisionIndex
 from neo.client.exception import NEOStorageError, NEOStorageNotFoundError
 from neo.client.exception import NEOStorageDoesNotExistError
-from neo.protocol import Packet, Packets, Errors, INVALID_TID
-from neo.util import makeChecksum
+from neo.lib.protocol import Packet, Packets, Errors, INVALID_TID
+from neo.lib.util import makeChecksum
 import time
 
 def _getMasterConnection(self):

Modified: trunk/neo/tests/client/testMasterHandler.py
==============================================================================
--- trunk/neo/tests/client/testMasterHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/client/testMasterHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,8 +18,8 @@
 import unittest
 from mock import Mock, ReturnValues
 from neo.tests import NeoUnitTestBase
-from neo.pt import PartitionTable
-from neo.protocol import NodeTypes, NodeStates
+from neo.lib.pt import PartitionTable
+from neo.lib.protocol import NodeTypes, NodeStates
 from neo.client.handlers.master import PrimaryBootstrapHandler
 from neo.client.handlers.master import PrimaryNotificationsHandler, \
        PrimaryAnswersHandler

Modified: trunk/neo/tests/client/testStorageHandler.py
==============================================================================
--- trunk/neo/tests/client/testStorageHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/client/testStorageHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,7 +18,7 @@
 import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
-from neo.protocol import NodeTypes, LockState
+from neo.lib.protocol import NodeTypes, LockState
 from neo.client.handlers.storage import StorageBootstrapHandler, \
        StorageAnswersHandler
 from neo.client.exception import NEOStorageError, NEOStorageNotFoundError

Modified: trunk/neo/tests/functional/__init__.py
==============================================================================
--- trunk/neo/tests/functional/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/__init__.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -29,8 +29,8 @@ import traceback
 import threading
 
 from neo.neoctl.neoctl import NeoCTL, NotReadyException
-from neo.protocol import ClusterStates, NodeTypes, CellStates, NodeStates
-from neo.util import dump
+from neo.lib.protocol import ClusterStates, NodeTypes, CellStates, NodeStates
+from neo.lib.util import dump
 from neo.tests import DB_ADMIN, DB_PASSWD, NeoTestBase
 from neo.client.Storage import Storage
 

Modified: trunk/neo/tests/functional/testMaster.py
==============================================================================
--- trunk/neo/tests/functional/testMaster.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/testMaster.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,7 +17,7 @@
 
 import unittest
 from neo.tests.functional import NEOCluster, NEOFunctionalTest
-from neo.protocol import NodeStates
+from neo.lib.protocol import NodeStates
 
 MASTER_NODE_COUNT = 3
 

Modified: trunk/neo/tests/functional/testStorage.py
==============================================================================
--- trunk/neo/tests/functional/testStorage.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/testStorage.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -20,7 +20,7 @@ import transaction
 from persistent import Persistent
 
 from neo.tests.functional import NEOCluster, NEOFunctionalTest
-from neo.protocol import ClusterStates, NodeStates
+from neo.lib.protocol import ClusterStates, NodeStates
 from MySQLdb import ProgrammingError
 from MySQLdb.constants.ER import NO_SUCH_TABLE
 

Modified: trunk/neo/tests/master/testClientHandler.py
==============================================================================
--- trunk/neo/tests/master/testClientHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testClientHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,7 +19,7 @@ import unittest
 from mock import Mock
 from struct import pack, unpack
 from neo.tests import NeoUnitTestBase
-from neo.protocol import NodeTypes, NodeStates, Packets
+from neo.lib.protocol import NodeTypes, NodeStates, Packets
 from neo.master.handlers.client import ClientServiceHandler
 from neo.master.app import Application
 

Modified: trunk/neo/tests/master/testElectionHandler.py
==============================================================================
--- trunk/neo/tests/master/testElectionHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testElectionHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,13 +17,13 @@
 
 import unittest
 from mock import Mock
-from neo import protocol
+from neo.lib import protocol
 from neo.tests import NeoUnitTestBase
-from neo.protocol import Packet, NodeTypes, NodeStates
+from neo.lib.protocol import Packet, NodeTypes, NodeStates
 from neo.master.handlers.election import ClientElectionHandler, ServerElectionHandler
 from neo.master.app import Application
-from neo.exception import ElectionFailure
-from neo.connection import ClientConnection
+from neo.lib.exception import ElectionFailure
+from neo.lib.connection import ClientConnection
 
 # patch connection so that we can register _addPacket messages
 # in mock object

Modified: trunk/neo/tests/master/testMasterApp.py
==============================================================================
--- trunk/neo/tests/master/testMasterApp.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testMasterApp.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,7 +19,7 @@ import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
 from neo.master.app import Application
-from neo.util import p64, u64
+from neo.lib.util import p64, u64
 
 class MasterAppTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/master/testMasterPT.py
==============================================================================
--- trunk/neo/tests/master/testMasterPT.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testMasterPT.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,9 +18,9 @@
 import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
-from neo.protocol import NodeStates, CellStates
+from neo.lib.protocol import NodeStates, CellStates
 from neo.master.pt import PartitionTable
-from neo.node import StorageNode
+from neo.lib.node import StorageNode
 
 class MasterPartitionTableTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/master/testRecovery.py
==============================================================================
--- trunk/neo/tests/master/testRecovery.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testRecovery.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,7 +18,7 @@
 import unittest
 from struct import pack, unpack
 from neo.tests import NeoUnitTestBase
-from neo.protocol import NodeTypes, NodeStates, CellStates
+from neo.lib.protocol import NodeTypes, NodeStates, CellStates
 from neo.master.recovery import RecoveryManager
 from neo.master.app import Application
 

Modified: trunk/neo/tests/master/testStorageHandler.py
==============================================================================
--- trunk/neo/tests/master/testStorageHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testStorageHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,11 +19,11 @@ import unittest
 from mock import Mock
 from struct import pack
 from neo.tests import NeoUnitTestBase
-from neo.protocol import NodeTypes, NodeStates, Packets
+from neo.lib.protocol import NodeTypes, NodeStates, Packets
 from neo.master.handlers.storage import StorageServiceHandler
 from neo.master.handlers.client import ClientServiceHandler
 from neo.master.app import Application
-from neo.exception import OperationFailure
+from neo.lib.exception import OperationFailure
 
 class MasterStorageHandlerTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/master/testTransactions.py
==============================================================================
--- trunk/neo/tests/master/testTransactions.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testTransactions.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,7 +19,7 @@ import unittest
 from mock import Mock
 from struct import pack, unpack
 from neo.tests import NeoUnitTestBase
-from neo.protocol import ZERO_TID
+from neo.lib.protocol import ZERO_TID
 
 from neo.master.transactions import Transaction, TransactionManager
 from neo.master.transactions import packTID, unpackTID, addTID, DelayedError

Modified: trunk/neo/tests/master/testVerification.py
==============================================================================
--- trunk/neo/tests/master/testVerification.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testVerification.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,7 +18,7 @@
 import unittest
 from struct import pack, unpack
 from neo.tests import NeoUnitTestBase
-from neo.protocol import NodeTypes, NodeStates
+from neo.lib.protocol import NodeTypes, NodeStates
 from neo.master.verification import VerificationManager, VerificationFailure
 from neo.master.app import Application
 

Modified: trunk/neo/tests/storage/testClientHandler.py
==============================================================================
--- trunk/neo/tests/storage/testClientHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testClientHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -22,9 +22,9 @@ from neo.tests import NeoUnitTestBase
 from neo.storage.app import Application
 from neo.storage.transactions import ConflictError, DelayedError
 from neo.storage.handlers.client import ClientOperationHandler
-from neo.protocol import INVALID_PARTITION
-from neo.protocol import INVALID_TID, INVALID_OID
-from neo.protocol import Packets, LockState
+from neo.lib.protocol import INVALID_PARTITION
+from neo.lib.protocol import INVALID_TID, INVALID_OID
+from neo.lib.protocol import Packets, LockState
 
 class StorageClientHandlerTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/storage/testIdentificationHandler.py
==============================================================================
--- trunk/neo/tests/storage/testIdentificationHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testIdentificationHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,8 +18,9 @@
 import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
-from neo.protocol import NodeTypes, NotReadyError, BrokenNodeDisallowedError
-from neo.pt import PartitionTable
+from neo.lib.protocol import NodeTypes, NotReadyError, 
+        BrokenNodeDisallowedError
+from neo.lib.pt import PartitionTable
 from neo.storage.app import Application
 from neo.storage.handlers.identification import IdentificationHandler
 

Modified: trunk/neo/tests/storage/testInitializationHandler.py
==============================================================================
--- trunk/neo/tests/storage/testInitializationHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testInitializationHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,11 +18,11 @@
 import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
-from neo.pt import PartitionTable
+from neo.lib.pt import PartitionTable
 from neo.storage.app import Application
 from neo.storage.handlers.initialization import InitializationHandler
-from neo.protocol import CellStates, ProtocolError
-from neo.exception import PrimaryFailure
+from neo.lib.protocol import CellStates, ProtocolError
+from neo.lib.exception import PrimaryFailure
 
 class StorageInitializationHandlerTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/storage/testMasterHandler.py
==============================================================================
--- trunk/neo/tests/storage/testMasterHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testMasterHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -21,10 +21,10 @@ from collections import deque
 from neo.tests import NeoUnitTestBase
 from neo.storage.app import Application
 from neo.storage.handlers.master import MasterOperationHandler
-from neo.exception import PrimaryFailure, OperationFailure
-from neo.pt import PartitionTable
-from neo.protocol import CellStates, ProtocolError, Packets
-from neo.protocol import INVALID_TID, INVALID_OID
+from neo.lib.exception import PrimaryFailure, OperationFailure
+from neo.lib.pt import PartitionTable
+from neo.lib.protocol import CellStates, ProtocolError, Packets
+from neo.lib.protocol import INVALID_TID, INVALID_OID
 
 class StorageMasterHandlerTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/storage/testReplication.py
==============================================================================
--- trunk/neo/tests/storage/testReplication.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testReplication.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -26,7 +26,7 @@ from neo.storage.handlers.replication im
 from neo.storage.handlers.replication import RANGE_LENGTH
 from neo.storage.handlers.storage import StorageOperationHandler
 from neo.storage.replicator import Replicator
-from neo.protocol import ZERO_OID, ZERO_TID
+from neo.lib.protocol import ZERO_OID, ZERO_TID
 
 MAX_TRANSACTIONS = 10000
 MAX_OBJECTS = 100000

Modified: trunk/neo/tests/storage/testReplicationHandler.py
==============================================================================
--- trunk/neo/tests/storage/testReplicationHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testReplicationHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,9 +17,9 @@
 
 import unittest
 from mock import Mock
-from neo.util import add64
+from neo.lib.util import add64
 from neo.tests import NeoUnitTestBase
-from neo.protocol import Packets, ZERO_OID, ZERO_TID
+from neo.lib.protocol import Packets, ZERO_OID, ZERO_TID
 from neo.storage.handlers.replication import ReplicationHandler
 from neo.storage.handlers.replication import RANGE_LENGTH, MIN_RANGE_LENGTH
 

Modified: trunk/neo/tests/storage/testReplicator.py
==============================================================================
--- trunk/neo/tests/storage/testReplicator.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testReplicator.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,7 +19,7 @@ import unittest
 from mock import Mock, ReturnValues
 from neo.tests import NeoUnitTestBase
 from neo.storage.replicator import Replicator, Partition, Task
-from neo.protocol import CellStates, NodeStates, Packets
+from neo.lib.protocol import CellStates, NodeStates, Packets
 
 class StorageReplicatorTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/storage/testStorageApp.py
==============================================================================
--- trunk/neo/tests/storage/testStorageApp.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testStorageApp.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,10 +19,10 @@ import unittest
 from mock import Mock, ReturnValues
 from neo.tests import NeoUnitTestBase
 from neo.storage.app import Application
-from neo.protocol import CellStates
+from neo.lib.protocol import CellStates
 from collections import deque
-from neo.pt import PartitionTable
-from neo.util import dump
+from neo.lib.pt import PartitionTable
+from neo.lib.util import dump
 from neo.storage.exception import AlreadyPendingError
 
 class StorageAppTests(NeoUnitTestBase):

Modified: trunk/neo/tests/storage/testStorageDBTests.py
==============================================================================
--- trunk/neo/tests/storage/testStorageDBTests.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testStorageDBTests.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,10 +17,10 @@
 
 import unittest
 from mock import Mock
-from neo.util import dump, p64, u64
-from neo.protocol import CellStates, ZERO_OID, ZERO_TID
+from neo.lib.util import dump, p64, u64
+from neo.lib.protocol import CellStates, ZERO_OID, ZERO_TID
 from neo.tests import NeoUnitTestBase
-from neo.exception import DatabaseFailure
+from neo.lib.exception import DatabaseFailure
 from neo.storage.database.mysqldb import MySQLDatabaseManager
 
 MAX_TID = '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE' # != INVALID_TID

Modified: trunk/neo/tests/storage/testStorageHandler.py
==============================================================================
--- trunk/neo/tests/storage/testStorageHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testStorageHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -21,8 +21,8 @@ from collections import deque
 from neo.tests import NeoUnitTestBase
 from neo.storage.app import Application
 from neo.storage.handlers.storage import StorageOperationHandler
-from neo.protocol import INVALID_PARTITION, Packets
-from neo.protocol import INVALID_TID, INVALID_OID
+from neo.lib.protocol import INVALID_PARTITION, Packets
+from neo.lib.protocol import INVALID_TID, INVALID_OID
 
 class StorageStorageHandlerTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/storage/testStorageMySQLdb.py
==============================================================================
--- trunk/neo/tests/storage/testStorageMySQLdb.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testStorageMySQLdb.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,7 +18,7 @@
 import unittest
 import MySQLdb
 from mock import Mock
-from neo.exception import DatabaseFailure
+from neo.lib.exception import DatabaseFailure
 from neo.tests.storage.testStorageDBTests import StorageDBTests
 from neo.storage.database.mysqldb import MySQLDatabaseManager
 

Modified: trunk/neo/tests/storage/testVerificationHandler.py
==============================================================================
--- trunk/neo/tests/storage/testVerificationHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testVerificationHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,12 +18,12 @@
 import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
-from neo.pt import PartitionTable
+from neo.lib.pt import PartitionTable
 from neo.storage.app import Application
 from neo.storage.handlers.verification import VerificationHandler
-from neo.protocol import CellStates, ErrorCodes
-from neo.exception import PrimaryFailure, OperationFailure
-from neo.util import p64, u64
+from neo.lib.protocol import CellStates, ErrorCodes
+from neo.lib.exception import PrimaryFailure, OperationFailure
+from neo.lib.util import p64, u64
 
 class StorageVerificationHandlerTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/testBootstrap.py
==============================================================================
--- trunk/neo/tests/testBootstrap.py [iso-8859-1] (original)
+++ trunk/neo/tests/testBootstrap.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,8 +19,8 @@ import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
 from neo.storage.app import Application
-from neo.bootstrap import BootstrapManager
-from neo.protocol import NodeTypes
+from neo.lib.bootstrap import BootstrapManager
+from neo.lib.protocol import NodeTypes
 
 class BootstrapManagerTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/testConnection.py
==============================================================================
--- trunk/neo/tests/testConnection.py [iso-8859-1] (original)
+++ trunk/neo/tests/testConnection.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,17 +17,17 @@
 import unittest
 from time import time
 from mock import Mock
-from neo.connection import ListeningConnection, Connection, \
+from neo.lib.connection import ListeningConnection, Connection, \
      ClientConnection, ServerConnection, MTClientConnection, \
      HandlerSwitcher, Timeout, PING_DELAY, PING_TIMEOUT, OnTimeout
-from neo.connector import getConnectorHandler, registerConnectorHandler
+from neo.lib.connector import getConnectorHandler, registerConnectorHandler
 from neo.tests import DoNothingConnector
-from neo.connector import ConnectorException, ConnectorTryAgainException, \
+from neo.lib.connector import ConnectorException, ConnectorTryAgainException, \
      ConnectorInProgressException, ConnectorConnectionRefusedException
-from neo.protocol import Packets, ParserState
+from neo.lib.protocol import Packets, ParserState
 from neo.tests import NeoUnitTestBase
-from neo.util import ReadBuffer
-from neo.locking import Queue
+from neo.lib.util import ReadBuffer
+from neo.lib.locking import Queue
 
 class ConnectionTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/testDispatcher.py
==============================================================================
--- trunk/neo/tests/testDispatcher.py [iso-8859-1] (original)
+++ trunk/neo/tests/testDispatcher.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,7 +17,7 @@
 
 from mock import Mock
 from neo.tests import NeoTestBase
-from neo.dispatcher import Dispatcher, ForgottenPacket
+from neo.lib.dispatcher import Dispatcher, ForgottenPacket
 from Queue import Queue
 import unittest
 

Modified: trunk/neo/tests/testEvent.py
==============================================================================
--- trunk/neo/tests/testEvent.py [iso-8859-1] (original)
+++ trunk/neo/tests/testEvent.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,8 +18,8 @@ import unittest
 from mock import Mock
 from time import time
 from neo.tests import NeoUnitTestBase
-from neo.epoll import Epoll
-from neo.event import EpollEventManager
+from neo.lib.epoll import Epoll
+from neo.lib.event import EpollEventManager
 
 class EventTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/testHandler.py
==============================================================================
--- trunk/neo/tests/testHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/testHandler.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,8 +18,8 @@
 import unittest
 from mock import Mock
 from neo.tests import NeoUnitTestBase
-from neo.handler import EventHandler
-from neo.protocol import PacketMalformedError, UnexpectedPacketError, \
+from neo.lib.handler import EventHandler
+from neo.lib.protocol import PacketMalformedError, UnexpectedPacketError, \
         BrokenNodeDisallowedError, NotReadyError, ProtocolError
 
 class HandlerTests(NeoUnitTestBase):

Modified: trunk/neo/tests/testNodes.py
==============================================================================
--- trunk/neo/tests/testNodes.py [iso-8859-1] (original)
+++ trunk/neo/tests/testNodes.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,10 +17,10 @@
 
 import unittest
 from mock import Mock
-from neo import protocol
-from neo.protocol import NodeTypes, NodeStates
-from neo.node import Node, MasterNode, StorageNode, ClientNode, AdminNode, \
-        NodeManager
+from neo.lib import protocol
+from neo.lib.protocol import NodeTypes, NodeStates
+from neo.lib.node import Node, MasterNode, StorageNode,
+        ClientNode, AdminNode, NodeManager
 from neo.tests import NeoUnitTestBase
 from time import time
 

Modified: trunk/neo/tests/testPT.py
==============================================================================
--- trunk/neo/tests/testPT.py [iso-8859-1] (original)
+++ trunk/neo/tests/testPT.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -17,9 +17,9 @@
 
 import unittest
 from mock import Mock
-from neo.protocol import NodeStates, CellStates
-from neo.pt import Cell, PartitionTable, PartitionTableException
-from neo.node import StorageNode
+from neo.lib.protocol import NodeStates, CellStates
+from neo.lib.pt import Cell, PartitionTable, PartitionTableException
+from neo.lib.node import StorageNode
 from neo.tests import NeoUnitTestBase
 
 class PartitionTableTests(NeoUnitTestBase):

Modified: trunk/neo/tests/testProtocol.py
==============================================================================
--- trunk/neo/tests/testProtocol.py [iso-8859-1] (original)
+++ trunk/neo/tests/testProtocol.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -16,8 +16,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 import unittest
-from neo.protocol import NodeTypes, NodeStates, CellStates, ClusterStates
-from neo.protocol import ErrorCodes, Packets, Errors, LockState
+from neo.lib.protocol import NodeTypes, NodeStates, CellStates, ClusterStates
+from neo.lib.protocol import ErrorCodes, Packets, Errors, LockState
 from neo.tests import NeoUnitTestBase
 
 class ProtocolTests(NeoUnitTestBase):

Modified: trunk/neo/tests/testUtil.py
==============================================================================
--- trunk/neo/tests/testUtil.py [iso-8859-1] (original)
+++ trunk/neo/tests/testUtil.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -18,7 +18,7 @@
 import unittest
 
 from neo.tests import NeoUnitTestBase
-from neo.util import ReadBuffer
+from neo.lib.util import ReadBuffer
 
 class UtilTests(NeoUnitTestBase):
 

Modified: trunk/neo/tests/zodb/__init__.py
==============================================================================
--- trunk/neo/tests/zodb/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/zodb/__init__.py [iso-8859-1] Mon Jan 17 16:25:37 2011
@@ -19,7 +19,7 @@ import os
 import unittest
 
 from neo.tests.functional import NEOCluster, NEOFunctionalTest
-import neo
+import neo.lib
 
 class ZODBTestCase(NEOFunctionalTest):
 

Removed: trunk/neo/util.py
==============================================================================
--- trunk/neo/util.py [iso-8859-1] (original)
+++ trunk/neo/util.py (removed)
@@ -1,191 +0,0 @@
-#
-# Copyright (C) 2006-2010  Nexedi SA
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-
-import re
-import socket
-from zlib import adler32
-from Queue import deque
-from struct import pack, unpack
-
-def u64(s):
-    return unpack('!Q', s)[0]
-
-def p64(n):
-    return pack('!Q', n)
-
-def add64(packed, offset):
-    """Add a python number to a 64-bits packed value"""
-    return p64(u64(packed) + offset)
-
-def dump(s):
-    """Dump a binary string in hex."""
-    if s is None:
-        return None
-    if isinstance(s, str):
-        ret = []
-        for c in s:
-            ret.append('%02x' % ord(c))
-        return ''.join(ret)
-    else:
-        return repr(s)
-
-
-def bin(s):
-    """Inverse of dump method."""
-    if s is None:
-        return None
-    ret = []
-    while len(s):
-        ret.append(chr(int(s[:2], 16)))
-        s = s[2:]
-    return ''.join(ret)
-
-
-def makeChecksum(s):
-    """Return a 4-byte integer checksum against a string."""
-    return adler32(s) & 0xffffffff
-
-
-def resolve(hostname):
-    """
-        Returns the first IP address that match with the given hostname
-    """
-    try:
-        # an IP resolves to itself
-        _, _, address_list = socket.gethostbyname_ex(hostname)
-    except socket.gaierror:
-        return None
-    return address_list[0]
-
-
-def parseMasterList(masters, except_node=None):
-    if not masters:
-        return []
-    # load master node list
-    master_node_list = []
-    # XXX: support '/' and ' ' as separator
-    masters = masters.replace('/', ' ')
-    for node in masters.split(' '):
-        ip_address, port = node.split(':')
-        ip_address = resolve(ip_address)
-        address = (ip_address, int(port))
-        if (address != except_node):
-            master_node_list.append(address)
-    return tuple(master_node_list)
-
-
-class Enum(dict):
-    """
-    Simulate an enumeration, define them as follow :
-        class MyEnum(Enum):
-          ITEM1 = Enum.Item(0)
-          ITEM2 = Enum.Item(1)
-    Enum items must be written in full upper case
-    """
-
-    class Item(int):
-
-        _enum = None
-        _name = None
-
-        def __new__(cls, value):
-            instance = super(Enum.Item, cls).__new__(cls, value)
-            instance._enum = None
-            instance._name = None
-            return instance
-
-        def __str__(self):
-            return self._name
-
-        def __repr__(self):
-            return "<EnumItem %s (%d)>" % (self._name, self)
-
-        def __eq__(self, other):
-            if other is None:
-                return False
-            assert isinstance(other, (Enum.Item, int, float, long))
-            if isinstance(other, Enum):
-                assert self._enum == other._enum
-            return int(self) == int(other)
-
-    def __init__(self):
-        dict.__init__(self)
-        for name in dir(self):
-            if not re.match('^[A-Z_]*$', name):
-                continue
-            item = getattr(self, name)
-            item._name = name
-            item._enum = self
-            self[int(item)] = item
-
-    def getByName(self, name):
-        return getattr(self, name)
-
-
-class ReadBuffer(object):
-    """
-        Implementation of a lazy buffer. Main purpose if to reduce useless
-        copies of data by storing chunks and join them only when the requested
-        size is available.
-    """
-
-    def __init__(self):
-        self.size = 0
-        self.content = deque()
-
-    def append(self, data):
-        """ Append some data and compute the new buffer size """
-        size = len(data)
-        self.size += size
-        self.content.append((size, data))
-
-    def __len__(self):
-        """ Return the current buffer size """
-        return self.size
-
-    def read(self, size):
-        """ Read and consume size bytes """
-        if self.size < size:
-            return None
-        self.size -= size
-        chunk_list = []
-        pop_chunk = self.content.popleft
-        append_data = chunk_list.append
-        to_read = size
-        chunk_len = 0
-        # select required chunks
-        while to_read > 0:
-            chunk_size, chunk_data = pop_chunk()
-            to_read -= chunk_size
-            append_data(chunk_data)
-        if to_read < 0:
-            # too many bytes consumed, cut the last chunk
-            last_chunk = chunk_list[-1]
-            keep, let = last_chunk[:to_read], last_chunk[to_read:]
-            self.content.appendleft((-to_read, let))
-            chunk_list[-1] = keep
-        # join all chunks (one copy)
-        data = ''.join(chunk_list)
-        assert len(data) == size
-        return data
-
-    def clear(self):
-        """ Erase all buffer content """
-        self.size = 0
-        self.content.clear()
-

Removed: trunk/tools/runner
==============================================================================
--- trunk/tools/runner [iso-8859-1] (original)
+++ trunk/tools/runner (removed)
@@ -1,311 +0,0 @@
-#! /usr/bin/env python
-#
-# Copyright (C) 2009  Nexedi SA
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import traceback
-import unittest
-import tempfile
-import logging
-import time
-import sys
-import neo
-import os
-
-from neo.tests.benchmark import BenchmarkRunner
-
-# list of test modules
-# each of them have to import its TestCase classes
-UNIT_TEST_MODULES = [ 
-    # generic parts
-    'neo.tests.testBootstrap',
-    'neo.tests.testConnection',
-    'neo.tests.testEvent',
-    'neo.tests.testHandler',
-    'neo.tests.testNodes',
-    'neo.tests.testProtocol',
-    'neo.tests.testDispatcher',
-    'neo.tests.testUtil',
-    'neo.tests.testPT',
-    # master application
-    'neo.tests.master.testClientHandler',
-    'neo.tests.master.testElectionHandler',
-    'neo.tests.master.testMasterApp',
-    'neo.tests.master.testMasterPT',
-    'neo.tests.master.testRecovery',
-    'neo.tests.master.testStorageHandler',
-    'neo.tests.master.testVerification',
-    'neo.tests.master.testTransactions',
-    # storage application
-    'neo.tests.storage.testClientHandler',
-    'neo.tests.storage.testInitializationHandler',
-    'neo.tests.storage.testMasterHandler',
-    'neo.tests.storage.testStorageApp',
-    'neo.tests.storage.testStorageHandler',
-    'neo.tests.storage.testStorageMySQLdb',
-    'neo.tests.storage.testStorageBTree',
-    'neo.tests.storage.testVerificationHandler',
-    'neo.tests.storage.testIdentificationHandler',
-    'neo.tests.storage.testTransactions',
-    'neo.tests.storage.testReplicationHandler',
-    'neo.tests.storage.testReplicator',
-    'neo.tests.storage.testReplication',
-    # client application
-    'neo.tests.client.testClientApp',
-    'neo.tests.client.testMasterHandler',
-    'neo.tests.client.testStorageHandler',
-    'neo.tests.client.testConnectionPool',
-]
-
-FUNC_TEST_MODULES = [
-    'neo.tests.functional.testMaster',
-    'neo.tests.functional.testClient',
-    'neo.tests.functional.testCluster',
-    'neo.tests.functional.testStorage',
-]
-
-ZODB_TEST_MODULES = [
-    ('neo.tests.zodb.testBasic', 'check'),
-    ('neo.tests.zodb.testConflict', 'check'),
-    ('neo.tests.zodb.testHistory', 'check'),
-    ('neo.tests.zodb.testIterator', 'check'),
-    ('neo.tests.zodb.testMT', 'check'),
-    ('neo.tests.zodb.testPack', 'check'),
-    ('neo.tests.zodb.testPersistent', 'check'),
-    ('neo.tests.zodb.testReadOnly', 'check'),
-    ('neo.tests.zodb.testRevision', 'check'),
-    #('neo.tests.zodb.testRecovery', 'check'),
-    ('neo.tests.zodb.testSynchronization', 'check'),
-    # ('neo.tests.zodb.testVersion', 'check'),
-    ('neo.tests.zodb.testUndo', 'check'),
-    ('neo.tests.zodb.testZODB', 'check'),
-]
-
-# configuration 
-ATTACH_LOG = False # for ZODB test, only the client side is logged
-LOG_FILE = 'neo.log' 
-
-# override logging configuration to send all messages to a file
-for logger_name in ('NEO', 'CLIENT'):
-    neo.setupLog(logger_name, filename=LOG_FILE)
-
-class NeoTestRunner(unittest.TestResult):
-    """ Custom result class to build report with statistics per module """
-
-    def __init__(self, title):
-        unittest.TestResult.__init__(self)
-        self._title = title
-        self.modulesStats = {}
-        self.failedImports = {}
-        self.lastStart = None
-        self.temp_directory = tempfile.mkdtemp(prefix='neo_')
-        print "Base directory : %s" % (self.temp_directory, )
-
-    def run(self, name, modules):
-        print '\n', name
-        suite = unittest.TestSuite()
-        loader = unittest.defaultTestLoader
-        for test_module in modules:
-            # load prefix if supplied
-            if isinstance(test_module, tuple):
-                test_module, prefix = test_module
-                loader.testMethodPrefix = prefix
-            else:
-                loader.testMethodPrefix = 'test'
-            try:
-                test_module = __import__(test_module, globals(), locals(), ['*'])
-            except ImportError, err:
-                self.failedImports[test_module] = err
-                print "Import of %s failed : %s" % (test_module, err)
-                traceback.print_exc()
-                continue
-            suite.addTests(loader.loadTestsFromModule(test_module))
-        suite.run(self)
-
-    class ModuleStats(object):
-        run = 0
-        errors = 0
-        success = 0
-        failures = 0
-        time = 0.0
-
-    def _getModuleStats(self, test):
-        module = test.__class__.__module__
-        module = tuple(module.split('.'))
-        try:
-            return self.modulesStats[module] 
-        except KeyError:
-            self.modulesStats[module] = self.ModuleStats()
-            return self.modulesStats[module]
-
-    def _updateTimer(self, stats):
-        stats.time += time.time() - self.lastStart
-
-    def startTest(self, test):
-        unittest.TestResult.startTest(self, test)
-        logging.info(" * TEST %s", test)
-        stats = self._getModuleStats(test)
-        stats.run += 1
-        self.lastStart = time.time()
-
-    def addSuccess(self, test):
-        print "OK"
-        unittest.TestResult.addSuccess(self, test)
-        stats = self._getModuleStats(test)
-        stats.success += 1
-        self._updateTimer(stats)
-
-    def addError(self, test, err):
-        print "ERROR"
-        unittest.TestResult.addError(self, test, err)
-        stats = self._getModuleStats(test)
-        stats.errors += 1
-        self._updateTimer(stats)
-
-    def addFailure(self, test, err):
-        print "FAIL"
-        unittest.TestResult.addFailure(self, test, err)
-        stats = self._getModuleStats(test)
-        stats.failures += 1
-        self._updateTimer(stats)
-
-    def _buildSummary(self, add_status):
-        success = self.testsRun - len(self.errors) - len(self.failures)
-        add_status('Directory', self.temp_directory)
-        add_status('Status', '%.3f%%' % (success * 100.0 / self.testsRun))
-        for var in os.environ.iterkeys():
-            if var.startswith('NEO_TEST'):
-                add_status(var, os.environ[var])
-        # visual
-        header       = "%25s |   run   | success |  errors |  fails  |   time   \n" % 'Test Module'
-        separator    = "%25s-+---------+---------+---------+---------+----------\n" % ('-' * 25)
-        format       = "%25s |   %3s   |   %3s   |   %3s   |   %3s   | %6.2fs   \n"
-        group_f      = "%25s |         |         |         |         |          \n" 
-        # header
-        s = ' ' * 30 + ' NEO TESTS REPORT'
-        s += '\n'
-        s += '\n' + header + separator
-        group = None
-        t_success = 0
-        # for each test case
-        for k, v in sorted(self.modulesStats.items()):
-            # display group below its content
-            _group = '.'.join(k[:-1])
-            if group is None:
-                group = _group
-            if _group != group:
-                s += separator + group_f % group + separator
-                group = _group
-            # test case stats
-            t_success += v.success
-            run, success = v.run or '.', v.success or '.'
-            errors, failures = v.errors or '.', v.failures or '.'
-            name = k[-1].lstrip('test')
-            args = (name, run, success, errors, failures, v.time)
-            s += format % args
-        # the last group
-        s += separator  + group_f % group + separator
-        # the final summary
-        errors, failures = len(self.errors) or '.', len(self.failures) or '.'
-        args = ("Summary", self.testsRun, t_success, errors, failures, self.time)
-        s += format % args + separator + '\n'
-        return s
-
-    def _buildErrors(self):
-        s = ''
-        test_formatter = lambda t: t.id()
-        if len(self.errors):
-            s += '\nERRORS:\n'
-            for test, trace in self.errors:
-                s += "%s\n" % test_formatter(test)
-                s += "-------------------------------------------------------------\n"
-                s += trace
-                s += "-------------------------------------------------------------\n"
-                s += '\n'
-        if len(self.failures):
-            s += '\nFAILURES:\n'
-            for test, trace in self.failures:
-                s += "%s\n" % test_formatter(test)
-                s += "-------------------------------------------------------------\n"
-                s += trace
-                s += "-------------------------------------------------------------\n"
-                s += '\n'
-        return s
-
-    def _buildWarnings(self):
-        s = '\n'
-        if self.failedImports:
-            s += 'Failed imports :\n'
-            for module, err in self.failedImports.items():
-                s += '%s:\n%s' % (module, err)
-        s += '\n'
-        return s
-
-    def buildReport(self, add_status):
-        self.time = sum([s.time for s in self.modulesStats.values()])
-        self.subject = "%s Tests, %s Errors, %s Failures" % (
-            self.testsRun, len(self.errors), len(self.failures))
-        summary = self._buildSummary(add_status)
-        errors = self._buildErrors()
-        warnings = self._buildWarnings()
-        report = '\n'.join([summary, errors, warnings])
-        return (self.subject, report)
-
-class TestRunner(BenchmarkRunner):
-
-    def add_options(self, parser):
-        parser.add_option('-f', '--functional', action='store_true')
-        parser.add_option('-u', '--unit', action='store_true')
-        parser.add_option('-z', '--zodb', action='store_true')
-
-    def load_options(self, options, args):
-        if not (options.unit or options.functional or options.zodb or args):
-            sys.exit('Nothing to run, please give one of -f, -u, -z')
-        return dict(
-            unit = options.unit,
-            functional = options.functional,
-            zodb = options.zodb,
-        )
-
-    def start(self):
-        config = self._config
-        # run requested tests
-        runner = NeoTestRunner(
-            title=config.title or 'Neo',
-        )
-        try:
-            if config.unit:
-                runner.run('Unit tests', UNIT_TEST_MODULES)
-            if config.functional:
-                runner.run('Functional tests', FUNC_TEST_MODULES)
-            if config.zodb:
-                runner.run('ZODB tests', ZODB_TEST_MODULES)
-        except KeyboardInterrupt:
-            config['mail_to'] = None
-            traceback.print_exc()
-        # build report
-        self._successful = runner.wasSuccessful()
-        return runner.buildReport(self.add_status)
-
-def main(args=None):
-    runner = TestRunner()
-    runner.run()
-    if not runner.was_successful():
-        sys.exit(1)
-    sys.exit(0)
-
-if __name__ == "__main__":
-    main()




More information about the Neo-report mailing list