[Erp5-report] r36243 seb - /erp5/trunk/products/ERP5Type/tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jun 10 18:04:46 CEST 2010
Author: seb
Date: Thu Jun 10 18:04:46 2010
New Revision: 36243
URL: http://svn.erp5.org?rev=36243&view=rev
Log:
add live_instance_path parameter to runUnitTest, this is nice
for executing unit test right after modification on a live
instance. This is working well only for tests working correctly
even if there is data created outside of themself.
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=36243&r1=36242&r2=36243&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/custom_zodb.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/custom_zodb.py [utf8] Thu Jun 10 18:04:46 2010
@@ -32,9 +32,10 @@ data_fs_path = os.environ.get('erp5_test
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))
+live_instance_path = os.environ.get('live_instance_path', None)
save_mysql = None
-if not zeo_client:
+if not zeo_client and live_instance_path is None:
def save_mysql(verbosity=1):
# The output of mysqldump needs to merge many lines at a time
# for performance reasons (merging lines is at most 10 times
@@ -62,9 +63,13 @@ if load:
_print("Restoring static files ... ")
for dir in static_dir_list:
full_path = os.path.join(instance_home, dir)
- if os.path.exists(full_path + '.bak'):
+ if live_instance_path is not None:
+ backup_path = os.path.join(live_instance_path, dir)
+ else:
+ backup_path = full_path + '.bak'
+ if os.path.exists(backup_path):
os.rmdir(full_path)
- shutil.copytree(full_path + '.bak', full_path, symlinks=True)
+ shutil.copytree(backup_path, full_path, symlinks=True)
elif save and not zeo_client and os.path.exists(data_fs_path):
os.remove(data_fs_path)
Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=36243&r1=36242&r2=36243&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] Thu Jun 10 18:04:46 2010
@@ -28,6 +28,14 @@ Options:
--data_fs_path to run tests on an existing
Data.fs
--data_fs_path=STRING Use the given path for the Data.fs
+ --live_instance_path=STRING
+ Use Data.fs, Document, PropertySheet, Constraint
+ from a live instance. This is very usefull in order
+ to try quickly a test without having to rebuild
+ testing data. This could be totally unsafe for you
+ instance, this depends if the test destroy existing
+ data or not.
+ It enable --save --load --data_fs_path
--bt5_path Search for Business Templates in the given list of
paths (or any HTTP url supported by template tool),
delimited with commas. In particular, BT can be
@@ -591,6 +599,7 @@ def main():
"update_business_templates",
"random_activity_priority=",
"activity_node=",
+ "live_instance_path=",
"zeo_client=",
"zeo_server=",
"zserver=",
@@ -659,6 +668,12 @@ def main():
os.environ["conversion_server_hostname"] = arg
elif opt == "--conversion_server_port":
os.environ["conversion_server_port"] = arg
+ elif opt == "--live_instance_path":
+ os.environ["live_instance_path"] = arg
+ os.environ["erp5_load_data_fs"] = "1"
+ os.environ["erp5_save_data_fs"] = "1"
+ os.environ["erp5_tests_data_fs_path"] = arg + '/var/Data.fs'
+ os.environ["ignore_mysql_dump"] = "1"
elif opt == "--use_dummy_mail_host":
os.environ["use_dummy_mail_host"] = "1"
elif opt == "--random_activity_priority":
More information about the Erp5-report
mailing list