Commit 36213d50 authored by Julien Muchembled's avatar Julien Muchembled

Unit tests:

* Slightly change purpose of some options, so that --load and --save can be combined:
  * --load reuses an existing unit test instance.
  * --save runs in persistent mode. Tests are skipped if --load is unset.
* --data_fs_path just allows to specify a Data.fs path other than the default one. Before this commit, the option was used without --load or --save. To get the previous behaviour, it must be used with --load. Note that it is now possible to use it with --save, what overwrites or modifies it.
* if --load is used and MySQL dump is missing, --recreate_catalog is automatically set.
* Drop now useless 'erp5_force_data_fs' environment variable.
* Import Products and static files in the correct order (= same as a normal instance).
* Enable DeadlockDebugger and start ZServer.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28043 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 60c3150b
...@@ -34,17 +34,7 @@ except ImportError: ...@@ -34,17 +34,7 @@ except ImportError:
import transaction import transaction
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase, user_name from Testing.ZopeTestCase.PortalTestCase import PortalTestCase, user_name
from Products.ERP5Type.tests.utils import getMySQLArguments
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.Utils import getLocalPropertySheetList, \
removeLocalPropertySheet, \
importLocalPropertySheet
from Products.ERP5Type.Utils import getLocalDocumentList, \
removeLocalDocument, \
importLocalDocument
from Products.ERP5Type.Utils import getLocalConstraintList, \
removeLocalConstraint, \
importLocalConstraint
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.Base import _aq_reset
from zLOG import LOG, DEBUG from zLOG import LOG, DEBUG
...@@ -54,6 +44,9 @@ install_product_quiet = 1 ...@@ -54,6 +44,9 @@ install_product_quiet = 1
# Quiet messages when installing business templates # Quiet messages when installing business templates
install_bt5_quiet = 0 install_bt5_quiet = 0
import OFS.Application
OFS.Application.import_products()
# Std Zope Products # Std Zope Products
ZopeTestCase.installProduct('ExtFile', quiet=install_product_quiet) ZopeTestCase.installProduct('ExtFile', quiet=install_product_quiet)
ZopeTestCase.installProduct('Photo', quiet=install_product_quiet) ZopeTestCase.installProduct('Photo', quiet=install_product_quiet)
...@@ -162,10 +155,6 @@ for priority, product_name, index, product_dir in get_products(): ...@@ -162,10 +155,6 @@ for priority, product_name, index, product_dir in get_products():
or os.path.isdir(os.path.join(product_dir, product_name, 'Tool')): or os.path.isdir(os.path.join(product_dir, product_name, 'Tool')):
ZopeTestCase.installProduct(product_name, quiet=install_product_quiet) ZopeTestCase.installProduct(product_name, quiet=install_product_quiet)
# Install Document types (circumvent different init order in ZopeTestCase)
from Products.ERP5Type.InitGenerator import initializeProductDocumentRegistry
initializeProductDocumentRegistry()
from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
from Acquisition import aq_base from Acquisition import aq_base
...@@ -226,7 +215,8 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -226,7 +215,8 @@ class ERP5TypeTestCase(PortalTestCase):
""" """
def dummy_test(self): def dummy_test(self):
ZopeTestCase._print('All tests are skipped with --save option.') ZopeTestCase._print('All tests are skipped when --save option is passed '
'with --update_business_templates or without --load')
def getRevision(self): def getRevision(self):
try: try:
...@@ -328,7 +318,7 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -328,7 +318,7 @@ class ERP5TypeTestCase(PortalTestCase):
erp5_catalog_storage = os.environ.get('erp5_catalog_storage', erp5_catalog_storage = os.environ.get('erp5_catalog_storage',
'erp5_mysql_innodb_catalog') 'erp5_mysql_innodb_catalog')
update_business_templates = os.environ.get('update_business_templates') is not None update_business_templates = os.environ.get('update_business_templates') is not None
erp5_load_data_fs = os.environ.get('erp5_load_data_fs') is not None erp5_load_data_fs = int(os.environ.get('erp5_load_data_fs', 0))
if update_business_templates and erp5_load_data_fs: if update_business_templates and erp5_load_data_fs:
update_only = os.environ.get('update_only', None) update_only = os.environ.get('update_only', None)
template_list = (erp5_catalog_storage, 'erp5_core', 'erp5_xhtml_style') + tuple(template_list) template_list = (erp5_catalog_storage, 'erp5_core', 'erp5_xhtml_style') + tuple(template_list)
...@@ -393,7 +383,6 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -393,7 +383,6 @@ class ERP5TypeTestCase(PortalTestCase):
global current_app global current_app
current_app = self.app current_app = self.app
self._updateConnectionStrings() self._updateConnectionStrings()
self._recreateCatalog()
def afterSetUp(self): def afterSetUp(self):
'''Called after setUp() has completed. This is '''Called after setUp() has completed. This is
...@@ -431,13 +420,12 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -431,13 +420,12 @@ class ERP5TypeTestCase(PortalTestCase):
"""Clear activities and catalog and recatalog everything. """Clear activities and catalog and recatalog everything.
Test runner can set `erp5_tests_recreate_catalog` environnement variable, Test runner can set `erp5_tests_recreate_catalog` environnement variable,
in that case we have to clear catalog. """ in that case we have to clear catalog. """
portal = self.getPortal()
if int(os.environ.get('erp5_tests_recreate_catalog', 0)): if int(os.environ.get('erp5_tests_recreate_catalog', 0)):
try: try:
self.login()
_start = time.time() _start = time.time()
if not quiet: if not quiet:
ZopeTestCase._print('\nRecreating catalog ... ') ZopeTestCase._print('\nRecreating catalog ... ')
portal = self.getPortal()
portal.portal_activities.manageClearActivities() portal.portal_activities.manageClearActivities()
portal.portal_catalog.manage_catalogClear() portal.portal_catalog.manage_catalogClear()
transaction.commit() transaction.commit()
...@@ -448,7 +436,6 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -448,7 +436,6 @@ class ERP5TypeTestCase(PortalTestCase):
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start,)) ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start,))
finally: finally:
os.environ['erp5_tests_recreate_catalog'] = '0' os.environ['erp5_tests_recreate_catalog'] = '0'
noSecurityManager()
# Utility methods specific to ERP5Type # Utility methods specific to ERP5Type
def getTemplateTool(self): def getTemplateTool(self):
...@@ -698,25 +685,23 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -698,25 +685,23 @@ class ERP5TypeTestCase(PortalTestCase):
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start)) ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start))
# Release locks # Release locks
transaction.commit() transaction.commit()
self.portal = portal
portal_activities = getattr(portal, 'portal_activities', None)
if os.environ.get('erp5_load_data_fs'): if len(setup_done) == 1: # make sure it is run only once
# Import local PropertySheets, Documents try:
for id_ in getLocalPropertySheetList(): from Products import DeadlockDebugger
importLocalPropertySheet(id_) except ImportError:
for id_ in getLocalDocumentList(): pass
importLocalDocument(id_) from Testing.ZopeTestCase.utils import startZServer
for id_ in getLocalConstraintList(): ZopeTestCase._print('Running ZServer on port %i\n'
importLocalConstraint(id_) % startZServer()[1])
else: if portal_activities is not None:
# Remove all local PropertySheets, Documents portal_activities.distributingNode = portal_activities.getCurrentNode()
for id_ in getLocalPropertySheetList(): portal_activities._nodes = portal_activities.distributingNode,
removeLocalPropertySheet(id_)
for id_ in getLocalDocumentList():
removeLocalDocument(id_)
for id_ in getLocalConstraintList():
removeLocalConstraint(id_)
self._updateConnectionStrings() self._updateConnectionStrings()
self._recreateCatalog()
update_business_templates = os.environ.get('update_business_templates') is not None update_business_templates = os.environ.get('update_business_templates') is not None
BusinessTemplate_getModifiedObject = aq_base(getattr(portal, 'BusinessTemplate_getModifiedObject', None)) BusinessTemplate_getModifiedObject = aq_base(getattr(portal, 'BusinessTemplate_getModifiedObject', None))
...@@ -762,7 +747,6 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -762,7 +747,6 @@ class ERP5TypeTestCase(PortalTestCase):
start = time.time() start = time.time()
# setUpOnce method may use self.app and self.portal # setUpOnce method may use self.app and self.portal
self.app = app self.app = app
self.portal = portal
setup_once() setup_once()
if not quiet: if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start)) ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
...@@ -775,7 +759,6 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -775,7 +759,6 @@ class ERP5TypeTestCase(PortalTestCase):
transaction.commit() transaction.commit()
portal_activities = getattr(portal, 'portal_activities', None)
if portal_activities is not None: if portal_activities is not None:
if not quiet: if not quiet:
ZopeTestCase._print('Executing pending activities ... ') ZopeTestCase._print('Executing pending activities ... ')
...@@ -804,33 +787,6 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -804,33 +787,6 @@ class ERP5TypeTestCase(PortalTestCase):
# Reset aq dynamic, so all unit tests will start again # Reset aq dynamic, so all unit tests will start again
_aq_reset() _aq_reset()
if os.environ.get('erp5_save_data_fs'):
# Quit the test in order to get a clean site
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,))
ZopeTestCase._print('Data.fs created\n')
transaction.commit()
ZopeTestCase.close(app)
instance_home = os.environ['INSTANCE_HOME']
# The output of mysqldump needs to merge many lines at a time
# for performance reasons (merging lines is at most 10 times
# faster, so this produce somewhat not nice to read sql
command = 'mysqldump %s > %s/dump.sql' \
% (getMySQLArguments(), instance_home)
if not quiet:
ZopeTestCase._print('Dumping MySQL database with %s... ' \
% command)
os.system(command)
if not quiet:
ZopeTestCase._print('done\n')
if not quiet:
ZopeTestCase._print('Dumping static files... ')
for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'):
os.system('rm -rf %s/%s.bak' % (instance_home, dir))
os.system('cp -ar %s/%s %s/%s.bak' % (instance_home, dir, instance_home, dir))
if not quiet:
ZopeTestCase._print('done\n')
# Log out # Log out
if not quiet: if not quiet:
ZopeTestCase._print('Logout ... \n') ZopeTestCase._print('Logout ... \n')
...@@ -844,18 +800,6 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -844,18 +800,6 @@ class ERP5TypeTestCase(PortalTestCase):
else: else:
transaction.commit() transaction.commit()
ZopeTestCase.close(app) ZopeTestCase.close(app)
if os.environ.get('erp5_load_data_fs'):
# Import local PropertySheets, Documents
# when loading an environnement
for id_ in getLocalPropertySheetList():
importLocalPropertySheet(id_)
for id_ in getLocalDocumentList():
importLocalDocument(id_)
for id_ in getLocalConstraintList():
importLocalConstraint(id_)
_aq_reset()
except: except:
f = StringIO() f = StringIO()
traceback.print_exc(file=f) traceback.print_exc(file=f)
......
...@@ -7,18 +7,19 @@ from ZODB.FileStorage import FileStorage ...@@ -7,18 +7,19 @@ from ZODB.FileStorage import FileStorage
from Products.ERP5Type.tests.utils import getMySQLArguments from Products.ERP5Type.tests.utils import getMySQLArguments
instance_home = os.environ.get('INSTANCE_HOME') instance_home = os.environ.get('INSTANCE_HOME')
data_fs_path = os.environ.get('erp5_tests_data_fs_path') data_fs_path = os.environ.get('erp5_tests_data_fs_path',
new_data_fs_path = os.path.join(instance_home, 'Data.fs') os.path.join(instance_home, 'Data.fs'))
load = int(os.environ.get('erp5_load_data_fs', 0))
save = int(os.environ.get('erp5_save_data_fs', 0))
if os.environ.get('erp5_load_data_fs'): if load:
if os.environ.get('erp5_force_data_fs'): dump_sql = os.path.join(instance_home, 'dump.sql')
Storage = FileStorage(new_data_fs_path) if os.path.exists(dump_sql):
else:
Storage = DemoStorage(base=FileStorage(new_data_fs_path), quota=(1<<20))
print("Restoring MySQL database ... ") print("Restoring MySQL database ... ")
ret = os.system("mysql %s < %s/dump.sql" % ( ret = os.system("mysql %s < %s" % (getMySQLArguments(), dump_sql))
getMySQLArguments(), instance_home)) assert not ret
assert ret == 0 else:
os.environ['erp5_tests_recreate_catalog'] = '1'
print("Restoring static files ... ") print("Restoring static files ... ")
for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'): for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'):
if os.path.exists(os.path.join(instance_home, '%s.bak' % dir)): if os.path.exists(os.path.join(instance_home, '%s.bak' % dir)):
...@@ -26,7 +27,7 @@ if os.environ.get('erp5_load_data_fs'): ...@@ -26,7 +27,7 @@ if os.environ.get('erp5_load_data_fs'):
shutil.rmtree(full_path) shutil.rmtree(full_path)
shutil.copytree(os.path.join(instance_home, '%s.bak' % dir), shutil.copytree(os.path.join(instance_home, '%s.bak' % dir),
full_path, symlinks=True) full_path, symlinks=True)
elif os.environ.get('erp5_save_data_fs'): else:
print("Cleaning static files ... ") print("Cleaning static files ... ")
for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'): for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'):
full_path = os.path.join(instance_home, dir) full_path = os.path.join(instance_home, dir)
...@@ -34,10 +35,12 @@ elif os.environ.get('erp5_save_data_fs'): ...@@ -34,10 +35,12 @@ elif os.environ.get('erp5_save_data_fs'):
assert os.path.isdir(full_path) assert os.path.isdir(full_path)
for f in glob.glob('%s/*' % full_path): for f in glob.glob('%s/*' % full_path):
os.unlink(f) os.unlink(f)
if os.path.exists(new_data_fs_path): if save and os.path.exists(data_fs_path):
os.remove(new_data_fs_path) os.remove(data_fs_path)
Storage = FileStorage(new_data_fs_path)
elif data_fs_path: if save:
Storage = FileStorage(data_fs_path)
elif load:
Storage = DemoStorage(base=FileStorage(data_fs_path), quota=(1<<20)) Storage = DemoStorage(base=FileStorage(data_fs_path), quota=(1<<20))
else: else:
Storage = DemoStorage(quota=(1<<20)) Storage = DemoStorage(quota=(1<<20))
...@@ -135,7 +135,7 @@ def main(): ...@@ -135,7 +135,7 @@ def main():
os.kill(firefox_pid, signal.SIGTERM) os.kill(firefox_pid, signal.SIGTERM)
def startZope(): def startZope():
os.environ['erp5_force_data_fs'] = "1" os.environ['erp5_save_data_fs'] = "1"
os.system('%s/bin/zopectl start' % instance_home) os.system('%s/bin/zopectl start' % instance_home)
sleep(2) # ad hoc sleep(2) # ad hoc
......
...@@ -5,11 +5,10 @@ import pdb ...@@ -5,11 +5,10 @@ import pdb
import re import re
import getopt import getopt
import unittest import unittest
import shutil
import errno
WIN = False WIN = os.name == 'nt'
if os.name == 'nt':
import shutil
WIN = True
__doc__ = """%(program)s: unit test runner for the ERP5 Project __doc__ = """%(program)s: unit test runner for the ERP5 Project
...@@ -23,17 +22,17 @@ Options: ...@@ -23,17 +22,17 @@ Options:
--portal_id=STRING force id of the portal. Useful when using --portal_id=STRING force id of the portal. Useful when using
--data_fs_path to run tests on an existing --data_fs_path to run tests on an existing
Data.fs Data.fs
--data_fs_path=STRING Path to the original Data.fs to run tests on an --data_fs_path=STRING Use the given path for the Data.fs
existing environment. The Data.fs is opened read
only
--bt5_path Path to the Business Templates. Default is --bt5_path Path to the Business Templates. Default is
INSTANCE_HOME/bt5. INSTANCE_HOME/bt5.
--recreate_catalog=0 or 1 recreate the content of the sql catalog. Default --recreate_catalog=0 or 1 recreate the content of the sql catalog. Default
is to recreate, unless using --data_fs_path is to recreate, unless using --data_fs_path
--save add erp5 sites and business templates in Data.fs --save Run unit tests in persistent mode (if unset,
and exit without invoking any tests existing Data.fs, dump.sql and *.bak static
--load load Data.fs and skip adding erp5 sites and folders are not modified). Tests are skipped
business templates if business templates are updated
or if --load is unset.
--load Reuse existing instance (created with --save).
--erp5_sql_connection_string=STRING --erp5_sql_connection_string=STRING
ZSQL Connection string for erp5_sql_connection, by ZSQL Connection string for erp5_sql_connection, by
default, it will use "test test" default, it will use "test test"
...@@ -174,10 +173,6 @@ if '__INSTANCE_HOME' not in globals().keys() : ...@@ -174,10 +173,6 @@ if '__INSTANCE_HOME' not in globals().keys() :
class ERP5TypeTestLoader(unittest.TestLoader): class ERP5TypeTestLoader(unittest.TestLoader):
"""Load test cases from the name passed on the command line. """Load test cases from the name passed on the command line.
""" """
def __init__(self, save=0):
if save:
self.testMethodPrefix = 'dummy_test'
def loadTestsFromName(self, name, module=None): def loadTestsFromName(self, name, module=None):
"""This method is here for compatibility with old style arguments. """This method is here for compatibility with old style arguments.
- It is possible to have the .py prefix for the test file - It is possible to have the .py prefix for the test file
...@@ -249,7 +244,10 @@ def runUnitTestList(test_list, verbosity=1, debug=0): ...@@ -249,7 +244,10 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
else: else:
products_home = os.path.join(instance_home, 'Products') products_home = os.path.join(instance_home, 'Products')
from Testing import ZopeTestCase import OFS.Application
import_products = OFS.Application.import_products
from Testing import ZopeTestCase # This will import custom_zodb.py
OFS.Application.import_products = import_products
try: try:
# On Zope 2.8, ZopeTestCase does not have any logging facility. # On Zope 2.8, ZopeTestCase does not have any logging facility.
...@@ -299,28 +297,30 @@ def runUnitTestList(test_list, verbosity=1, debug=0): ...@@ -299,28 +297,30 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
# it is then possible to run the debugger by "import pdb; pdb.set_trace()" # it is then possible to run the debugger by "import pdb; pdb.set_trace()"
sys.path.insert(0, tests_framework_home) sys.path.insert(0, tests_framework_home)
save = 0 test_loader = ERP5TypeTestLoader()
# pass save=1 to test loader to skip all tests in save mode
# and monkeypatch PortalTestCase.setUp to skip beforeSetUp and afterSetUp. save = int(os.environ.get('erp5_save_data_fs', 0))
# Also patch unittest.makeSuite, as it's used in test_suite function in dummy_test = save and (int(os.environ.get('update_business_templates', 0))
# test cases. or not int(os.environ.get('erp5_load_data_fs', 0)))
if os.environ.get('erp5_save_data_fs'): if dummy_test:
# Skip all tests in save mode and monkeypatch PortalTestCase.setUp
# to skip beforeSetUp and afterSetUp. Also patch unittest.makeSuite,
# as it's used in test_suite function in test cases.
from Products.ERP5Type.tests.ERP5TypeTestCase import \ from Products.ERP5Type.tests.ERP5TypeTestCase import \
dummy_makeSuite, dummy_setUp, dummy_tearDown dummy_makeSuite, dummy_setUp, dummy_tearDown
save = 1
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
unittest.makeSuite = dummy_makeSuite unittest.makeSuite = dummy_makeSuite
PortalTestCase.setUp = dummy_setUp PortalTestCase.setUp = dummy_setUp
PortalTestCase.tearDown = dummy_tearDown PortalTestCase.tearDown = dummy_tearDown
test_loader.testMethodPrefix = 'dummy_test'
suite = ERP5TypeTestLoader(save=save).loadTestsFromNames(test_list) suite = test_loader.loadTestsFromNames(test_list)
# Hack the profiler to run only specified test methods, and wrap results when # Hack the profiler to run only specified test methods, and wrap results when
# running in debug mode. We also monkeypatch unittest.TestCase for tests that # running in debug mode. We also monkeypatch unittest.TestCase for tests that
# does not use ERP5TypeTestCase # does not use ERP5TypeTestCase
run_only = os.environ.get('run_only', '') if not dummy_test:
if not save: test_method_list = os.environ.get('run_only', '').split(',')
test_method_list = run_only.split(',')
def wrapped_run(run_orig): def wrapped_run(run_orig):
# wrap the method that run the test to run test method only if its name # wrap the method that run the test to run test method only if its name
...@@ -341,11 +341,33 @@ def runUnitTestList(test_list, verbosity=1, debug=0): ...@@ -341,11 +341,33 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
from unittest import TestCase from unittest import TestCase
TestCase.__call__ = wrapped_run(TestCase.__call__) TestCase.__call__ = wrapped_run(TestCase.__call__)
# change current directory to the test home, to create zLOG.log in this dir. # change current directory to the test home, to create zLOG.log in this dir.
os.chdir(tests_home) os.chdir(tests_home)
return TestRunner(verbosity=verbosity).run(suite) result = TestRunner(verbosity=verbosity).run(suite)
if save:
from Products.ERP5Type.tests.utils import getMySQLArguments
# The output of mysqldump needs to merge many lines at a time
# for performance reasons (merging lines is at most 10 times
# faster, so this produce somewhat not nice to read sql
command = 'mysqldump %s > %s' % (getMySQLArguments(),
os.path.join(instance_home, 'dump.sql'))
if verbosity:
print('Dumping MySQL database with %s... ' % command)
os.system(command)
if verbosity:
print('Dumping static files... ')
for static_dir in 'Constraint', 'Document', 'Extensions', 'PropertySheet':
static_dir = os.path.join(instance_home, static_dir)
try:
shutil.rmtree(static_dir + '.bak')
except OSError, e:
if e.errno != errno.ENOENT:
raise
shutil.copytree(static_dir, static_dir + '.bak', symlinks=True)
return result
def usage(stream, msg=None): def usage(stream, msg=None):
if msg: if msg:
...@@ -379,8 +401,6 @@ def main(): ...@@ -379,8 +401,6 @@ def main():
os.environ["erp5_tests_recreate_catalog"] = "0" os.environ["erp5_tests_recreate_catalog"] = "0"
verbosity = 1 verbosity = 1
debug = 0 debug = 0
load = False
save = False
for opt, arg in opts: for opt, arg in opts:
if opt in ("-v", "--verbose"): if opt in ("-v", "--verbose"):
...@@ -418,10 +438,8 @@ def main(): ...@@ -418,10 +438,8 @@ def main():
os.environ["email_from_address"] = arg os.environ["email_from_address"] = arg
elif opt == "--save": elif opt == "--save":
os.environ["erp5_save_data_fs"] = "1" os.environ["erp5_save_data_fs"] = "1"
save = True
elif opt == "--load": elif opt == "--load":
os.environ["erp5_load_data_fs"] = "1" os.environ["erp5_load_data_fs"] = "1"
load = True
elif opt == "--erp5_catalog_storage": elif opt == "--erp5_catalog_storage":
os.environ["erp5_catalog_storage"] = arg os.environ["erp5_catalog_storage"] = arg
elif opt == "--run_only": elif opt == "--run_only":
...@@ -432,9 +450,6 @@ def main(): ...@@ -432,9 +450,6 @@ def main():
elif opt == "--update_business_templates": elif opt == "--update_business_templates":
os.environ["update_business_templates"] = "1" os.environ["update_business_templates"] = "1"
if load and save:
os.environ["erp5_force_data_fs"] = "1"
test_list = args test_list = args
if not test_list: if not test_list:
print "No test to run, exiting immediately." print "No test to run, exiting immediately."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment