[Neo-report] r2822 jm - in /trunk/neo/tests: ./ functional/ threaded/
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Sep 5 18:24:48 CEST 2011
Author: jm
Date: Mon Sep 5 18:24:48 2011
New Revision: 2822
Log:
tests: fix possible freezes when threaded unit test ends
Modified:
trunk/neo/tests/__init__.py
trunk/neo/tests/functional/__init__.py
trunk/neo/tests/threaded/__init__.py
Modified: trunk/neo/tests/__init__.py
==============================================================================
--- trunk/neo/tests/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/__init__.py [iso-8859-1] Mon Sep 5 18:24:48 2011
@@ -24,6 +24,7 @@ import tempfile
import unittest
import MySQLdb
import neo
+import transaction
from mock import Mock
from neo.lib import debug, logger, protocol, setupLog
@@ -122,6 +123,10 @@ class NeoTestBase(unittest.TestCase):
setupLog(test_method, log_file, True)
def tearDown(self):
+ # Kill all unfinished transactions for next test.
+ # Note we don't even abort them because it may require a valid
+ # connection to a master node (see Storage.sync()).
+ transaction.manager.__init__()
unittest.TestCase.tearDown(self)
sys.stdout.write('\n')
sys.stdout.flush()
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 Sep 5 18:24:48 2011
@@ -30,7 +30,6 @@ import tempfile
import traceback
import threading
import psutil
-import transaction
import neo.scripts
from neo.neoctl.neoctl import NeoCTL, NotReadyException
@@ -614,13 +613,6 @@ class NEOCluster(object):
class NEOFunctionalTest(NeoTestBase):
- def tearDown(self):
- # Kill all unfinished transactions for next test.
- # Note we don't even abort them because it may require a valid
- # connection to a master node (see Storage.sync()).
- transaction.manager.__init__()
- NeoTestBase.tearDown(self)
-
def setupLog(self):
log_file = os.path.join(self.getTempDirectory(), 'test.log')
setupLog('TEST', log_file, True)
Modified: trunk/neo/tests/threaded/__init__.py
==============================================================================
--- trunk/neo/tests/threaded/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/threaded/__init__.py [iso-8859-1] Mon Sep 5 18:24:48 2011
@@ -32,7 +32,7 @@ from neo.lib.connector import SocketConn
from neo.lib.event import EventManager
from neo.lib.protocol import CellStates, ClusterStates, NodeStates, NodeTypes
from neo.lib.util import SOCKET_CONNECTORS_DICT, parseMasterList
-from neo.tests import NeoUnitTestBase, getTempDirectory, setupMySQLdb, \
+from neo.tests import NeoTestBase, getTempDirectory, setupMySQLdb, \
ADDRESS_TYPE, IP_VERSION_FORMAT_DICT, DB_PREFIX, DB_USER
BIND = IP_VERSION_FORMAT_DICT[ADDRESS_TYPE], 0
@@ -327,7 +327,8 @@ class NEOCluster(object):
self.remote_addr = addr
def send(self, msg):
result = cls.SocketConnector_send(self, msg)
- Serialized.pending = 1
+ if Serialized.pending is not None:
+ Serialized.pending = 1
return result
# TODO: 'sleep' should 'tic' in a smart way, so that storages can be
# safely started even if the cluster isn't.
@@ -493,7 +494,7 @@ class NEOCluster(object):
return txn, self.db.open(transaction_manager=txn)
-class NEOThreadedTest(NeoUnitTestBase):
+class NEOThreadedTest(NeoTestBase):
def setupLog(self):
log_file = os.path.join(getTempDirectory(), self.id() + '.log')
More information about the Neo-report
mailing list