[Erp5-report] r30459 - in /erp5/trunk/products/ERP5Type/tests: custom_zodb.py runUnitTest.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Nov 10 11:29:59 CET 2009
Author: jm
Date: Tue Nov 10 11:29:58 2009
New Revision: 30459
URL: http://svn.erp5.org?rev=30459&view=rev
Log:
Unit test: print first line to stderr (this fixes ouput of testPerformance)
Modified:
erp5/trunk/products/ERP5Type/tests/custom_zodb.py
erp5/trunk/products/ERP5Type/tests/runUnitTest.py
Modified: erp5/trunk/products/ERP5Type/tests/custom_zodb.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/custom_zodb.py?rev=30459&r1=30458&r2=30459&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/custom_zodb.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/custom_zodb.py [utf8] Tue Nov 10 11:29:58 2009
@@ -1,10 +1,13 @@
import os
import shutil
+import sys
import glob
import ZODB
from ZODB.DemoStorage import DemoStorage
from ZODB.FileStorage import FileStorage
from Products.ERP5Type.tests.utils import getMySQLArguments
+
+_print = sys.stderr.write
instance_home = os.environ.get('INSTANCE_HOME')
data_fs_path = os.environ.get('erp5_tests_data_fs_path',
@@ -15,12 +18,12 @@
if load:
dump_sql = os.path.join(instance_home, 'dump.sql')
if os.path.exists(dump_sql):
- print "Restoring MySQL database ...",
+ _print("Restoring MySQL database ... ")
ret = os.system("mysql %s < %s" % (getMySQLArguments(), dump_sql))
assert not ret
else:
os.environ['erp5_tests_recreate_catalog'] = '1'
- print "Restoring static files ...",
+ _print("Restoring static files ... ")
for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'):
if os.path.exists(os.path.join(instance_home, '%s.bak' % dir)):
full_path = os.path.join(instance_home, dir)
@@ -28,7 +31,7 @@
shutil.copytree(os.path.join(instance_home, '%s.bak' % dir),
full_path, symlinks=True)
else:
- print "Cleaning static files ...",
+ _print("Cleaning static files ... ")
for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'):
full_path = os.path.join(instance_home, dir)
if os.path.exists(full_path):
@@ -45,4 +48,4 @@
else:
Storage = DemoStorage()
-print "Instance at %r loaded ..." % instance_home,
+_print("Instance at %r loaded ... " % instance_home)
Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=30459&r1=30458&r2=30459&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] Tue Nov 10 11:29:58 2009
@@ -291,10 +291,11 @@
def __getattr__(self, attr):
return getattr(self.result, attr)
+_print = sys.stderr.write
def runUnitTestList(test_list, verbosity=1, debug=0):
if not test_list:
- print "No test to run, exiting immediately."
+ _print("No test to run, exiting immediately.\n")
return
os.environ.setdefault('INSTANCE_HOME', instance_home)
os.environ.setdefault('SOFTWARE_HOME', software_home)
@@ -303,7 +304,7 @@
os.environ.setdefault('EVENT_LOG_FILE', os.path.join(tests_home, 'zLOG.log'))
os.environ.setdefault('EVENT_LOG_SEVERITY', '-300')
- print "Loading Zope ...",
+ _print("Loading Zope ... ")
_start = time.time()
import Testing
@@ -431,7 +432,7 @@
# ourselves
layer.ZopeLite.setUp()
- print 'done (%.3fs)' % (time.time() - _start),
+ _print('done (%.3fs)' % (time.time() - _start))
result = TestRunner(verbosity=verbosity).run(suite)
if save:
@@ -442,10 +443,10 @@
command = 'mysqldump %s > %s' % (getMySQLArguments(),
os.path.join(instance_home, 'dump.sql'))
if verbosity:
- print('Dumping MySQL database with %s... ' % command)
+ _print('Dumping MySQL database with %s...\n' % command)
os.system(command)
if verbosity:
- print('Dumping static files... ')
+ _print('Dumping static files...\n')
for static_dir in 'Constraint', 'Document', 'Extensions', 'PropertySheet':
static_dir = os.path.join(instance_home, static_dir)
try:
@@ -538,7 +539,7 @@
test_list = args
if not test_list:
- print "No test to run, exiting immediately."
+ _print("No test to run, exiting immediately.\n")
sys.exit(1)
result = runUnitTestList(test_list=test_list,
@@ -548,7 +549,7 @@
from Testing.ZopeTestCase import profiler
except ImportError:
if os.environ.get('PROFILE_TESTS') == '1':
- print "Profiler support is not available from ZopeTestCase in Zope 2.12"
+ _print("Profiler support is not available from ZopeTestCase in Zope 2.12\n")
else:
profiler.print_stats()
sys.exit(len(result.failures) + len(result.errors))
More information about the Erp5-report
mailing list