Commit 330fdbfa authored by Sebastien Robin's avatar Sebastien Robin

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.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36243 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9289ab45
......@@ -32,9 +32,10 @@ data_fs_path = os.environ.get('erp5_tests_data_fs_path',
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)
......
......@@ -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":
......
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