Commit 6998af35 authored by Michael Terry's avatar Michael Terry

tests: some small improvements to the mock duplicity: grab logfd first thing...

tests: some small improvements to the mock duplicity:  grab logfd first thing and call scripts after writing back the mockscript
parent 262d8d91
......@@ -46,6 +46,14 @@
import sys, os, shlex, getpass, time, subprocess
# Where should we spit our messages to?
logfd = None
for i in xrange(len(sys.argv)):
split = sys.argv[i].split('=', 1)
if len(split) > 1 and split[0] == "--log-fd":
logfd = os.fdopen(int(split[1]), "w")
sys.argv[i] = "--log-fd=?"
if not os.path.exists(os.environ['DEJA_DUP_TEST_MOCKSCRIPT']):
print >> logfd, "TESTFAIL: no mockscript"
sys.exit(-1)
......@@ -81,14 +89,6 @@ while len(lines) > curline and lines[curline].strip():
script = ' '.join(tokens[1:])
curline += 1
# Where should we spit our messages to?
logfd = None
for i in xrange(len(sys.argv)):
split = sys.argv[i].split('=', 1)
if len(split) > 1 and split[0] == "--log-fd":
logfd = os.fdopen(int(split[1]), "w")
sys.argv[i] = "--log-fd=?"
if expected_args != sys.argv[1:]:
print >> logfd, "TESTFAIL: expected\n%s\nvs\n%s" % (expected_args, sys.argv[1:])
sys.exit(-1)
......@@ -99,9 +99,6 @@ while len(lines) > curline and lines[curline] != "=== deja-dup ===\n":
print >> logfd, lines[curline],
curline += 1
if script:
subprocess.call(script, shell=True)
# Write back mockscript
if len(lines) <= curline:
os.unlink(os.environ['DEJA_DUP_TEST_MOCKSCRIPT'])
......@@ -110,6 +107,9 @@ else:
with open(os.environ['DEJA_DUP_TEST_MOCKSCRIPT'], 'w') as f:
f.writelines(lines)
if script:
subprocess.call(script, shell=True)
time.sleep(delay)
sys.exit(rv)
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