[Neo-report] r2738 jm - in /trunk/neo: lib/ scripts/ tests/ tests/functional/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 28 14:52:57 CEST 2011
Author: jm
Date: Thu Apr 28 14:52:57 2011
New Revision: 2738
Log:
tests: output logs of parent process in temporary directory of current run
Modified:
trunk/neo/lib/__init__.py
trunk/neo/scripts/neoadmin.py
trunk/neo/scripts/neomaster.py
trunk/neo/scripts/neomigrate.py
trunk/neo/scripts/neostorage.py
trunk/neo/scripts/runner.py
trunk/neo/tests/__init__.py
trunk/neo/tests/functional/__init__.py
Modified: trunk/neo/lib/__init__.py
==============================================================================
--- trunk/neo/lib/__init__.py [iso-8859-1] (original)
+++ trunk/neo/lib/__init__.py [iso-8859-1] Thu Apr 28 14:52:57 2011
@@ -38,7 +38,7 @@ def setupLog(name='NEO', filename=None,
level = logging_std.DEBUG
else:
level = logging_std.INFO
- logging = logging_std.getLogger(name.upper())
+ logging = logging_std.getLogger(name)
for handler in logging.handlers[:]:
logging.removeHandler(handler)
if filename is None:
Modified: trunk/neo/scripts/neoadmin.py
==============================================================================
--- trunk/neo/scripts/neoadmin.py [iso-8859-1] (original)
+++ trunk/neo/scripts/neoadmin.py [iso-8859-1] Thu Apr 28 14:52:57 2011
@@ -58,7 +58,7 @@ def main(args=None):
)
# setup custom logging
- setupLog(config.getName(), options.logfile or None, options.verbose)
+ setupLog(config.getName().upper(), options.logfile or None, options.verbose)
# and then, load and run the application
from neo.admin.app import Application
Modified: trunk/neo/scripts/neomaster.py
==============================================================================
--- trunk/neo/scripts/neomaster.py [iso-8859-1] (original)
+++ trunk/neo/scripts/neomaster.py [iso-8859-1] Thu Apr 28 14:52:57 2011
@@ -62,7 +62,7 @@ def main(args=None):
)
# setup custom logging
- setupLog(config.getName(), options.logfile or None, options.verbose)
+ setupLog(config.getName().upper(), options.logfile or None, options.verbose)
# and then, load and run the application
from neo.master.app import Application
Modified: trunk/neo/scripts/neomigrate.py
==============================================================================
--- trunk/neo/scripts/neomigrate.py [iso-8859-1] (original)
+++ trunk/neo/scripts/neomigrate.py [iso-8859-1] Thu Apr 28 14:52:57 2011
@@ -47,7 +47,7 @@ def main(args=None):
raise RuntimeError('The NEO cluster name must be supplied')
# set up logging
- setupLog('neomigrate', None, options.verbose or False)
+ setupLog('NEOMIGRATE', None, options.verbose or False)
# open storages
from ZODB.FileStorage import FileStorage
Modified: trunk/neo/scripts/neostorage.py
==============================================================================
--- trunk/neo/scripts/neostorage.py [iso-8859-1] (original)
+++ trunk/neo/scripts/neostorage.py [iso-8859-1] Thu Apr 28 14:52:57 2011
@@ -68,7 +68,7 @@ def main(args=None):
)
# setup custom logging
- setupLog(config.getName(), options.logfile or None, options.verbose)
+ setupLog(config.getName().upper(), options.logfile or None, options.verbose)
# and then, load and run the application
from neo.storage.app import Application
Modified: trunk/neo/scripts/runner.py
==============================================================================
--- trunk/neo/scripts/runner.py [iso-8859-1] (original)
+++ trunk/neo/scripts/runner.py [iso-8859-1] Thu Apr 28 14:52:57 2011
@@ -94,13 +94,6 @@ ZODB_TEST_MODULES = [
('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.lib.setupLog(logger_name, filename=LOG_FILE)
class NeoTestRunner(unittest.TestResult):
""" Custom result class to build report with statistics per module """
Modified: trunk/neo/tests/__init__.py
==============================================================================
--- trunk/neo/tests/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/__init__.py [iso-8859-1] Thu Apr 28 14:52:57 2011
@@ -26,7 +26,7 @@ import MySQLdb
import neo
from mock import Mock
-from neo.lib import debug, logger, protocol
+from neo.lib import debug, logger, protocol, setupLog
from neo.lib.protocol import Packets
from neo.lib.util import getAddressType
from time import time, gmtime
@@ -92,8 +92,14 @@ class NeoTestBase(unittest.TestCase):
logger.PACKET_LOGGER.enable(True)
sys.stdout.write(' * %s ' % (self.id(), ))
sys.stdout.flush()
+ self.setupLog()
unittest.TestCase.setUp(self)
+ def setupLog(self):
+ test_case, test_method = self.id().rsplit('.', 1)
+ log_file = os.path.join(getTempDirectory(), test_case + '.log')
+ setupLog(test_method, log_file, True)
+
def tearDown(self):
unittest.TestCase.tearDown(self)
sys.stdout.write('\n')
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] Thu Apr 28 14:52:57 2011
@@ -33,6 +33,7 @@ import psutil
import neo.scripts
from neo.neoctl.neoctl import NeoCTL, NotReadyException
+from neo.lib import setupLog
from neo.lib.protocol import ClusterStates, NodeTypes, CellStates, NodeStates
from neo.lib.util import dump, SOCKET_CONNECTORS_DICT
from neo.tests import DB_ADMIN, DB_PASSWD, NeoTestBase, buildUrlFromString, \
@@ -635,6 +636,10 @@ class NEOCluster(object):
class NEOFunctionalTest(NeoTestBase):
+ def setupLog(self):
+ log_file = os.path.join(self.getTempDirectory(), 'test.log')
+ setupLog('TEST', log_file, True)
+
def getTempDirectory(self):
# build the full path based on test case and current test method
temp_dir = os.path.join(getTempDirectory(), self.id())
More information about the Neo-report
mailing list