Commit 7e3bdfc2 authored by Jérome Perrin's avatar Jérome Perrin

tests: save mysqldump atomically with runUnitTest --save

The pattern of using > will start by erasing the file, so if mysqldump
does not run to completion developer will loose the previous dump, but
in such case, that previous dump was better than nothing.
parent 206271c8
......@@ -40,10 +40,11 @@ if save_mysql:
# 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(), dump_sql_path,)
command = 'mysqldump %s > %s.tmp' % (getMySQLArguments(), dump_sql_path,)
if verbosity:
_print('Dumping MySQL database with %s ...' % command)
subprocess.check_call(command, shell=True)
os.rename(dump_sql_path + '.tmp', dump_sql_path)
if load:
if save_mysql:
......
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