Commit 8939612b authored by Jérome Perrin's avatar Jérome Perrin

Fix a dangerous bug happenning in runUnitTest --save :

Since r23751, unit tests instance have a folder for Extensions, and this folder
is cleaned up before --save. Before r23751, this folder was a symlink to the
real instance home's Extensions, so if you run --save on a test instance
initialized before this change, extensions from your real instance will be
removed.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24206 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9545e4fe
......@@ -31,6 +31,7 @@ elif os.environ.get('erp5_save_data_fs'):
for dir in ('Constraint', 'Document', 'PropertySheet', 'Extensions'):
full_path = os.path.join(instance_home, dir)
if os.path.exists(full_path):
assert os.path.isdir(full_path)
for f in glob.glob('%s/*' % full_path):
os.unlink(f)
if os.path.exists(new_data_fs_path):
......
......@@ -77,6 +77,15 @@ def initializeInstanceHome(tests_framework_home,
instance_home):
if not os.path.exists(instance_home):
os.mkdir(instance_home)
# Before r23751, Extensions dir was initialized to be a symlink to real
# instance home Extensions folder, now it's initialized as an independant
# folder. If this test instance still have a symlink for Extensions, change
# it in a foler.
extensions_path = os.path.join(instance_home, 'Extensions')
if os.path.islink(extensions_path):
os.unlink(extensions_path)
for d in ('Extensions', 'Constraint', 'Document', 'PropertySheet', 'bin', 'etc', 'tests', 'var', 'log'):
path = os.path.join(instance_home, d)
if not os.path.exists(path):
......
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