pytest: Use the file object and don't use print without line-endings

This commit is contained in:
Christian Decker 2018-08-06 21:52:38 +02:00 committed by Rusty Russell
parent ae99e493b8
commit 90f74907f9
2 changed files with 4 additions and 6 deletions

View File

@ -164,8 +164,7 @@ def printCrashLog(node):
errors, fname = getCrashLog(node)
if errors:
print("-" * 10, "{} (last 50 lines)".format(fname), "-" * 10)
for l in errors[-50:]:
print(l, end='')
print("".join(errors[-50:]))
print("-" * 80)
return 1 if errors else 0

View File

@ -679,10 +679,9 @@ class NodeFactory(object):
if fake_bitcoin_cli:
cli = os.path.join(lightning_dir, "fake-bitcoin-cli")
with open(cli, "w") as text_file:
print("""#! /bin/sh
! [ -f bitcoin-cli-fail ] || exit `cat bitcoin-cli-fail`
exec bitcoin-cli "$@"
""", file=text_file)
text_file.write('#! /bin/sh\n'
'! [ -f bitcoin-cli-fail ] || exit `cat bitcoin-cli-fail`\n'
'exec bitcoin-cli "$@"\n')
os.chmod(cli, os.stat(cli).st_mode | stat.S_IEXEC)
daemon.opts['bitcoin-cli'] = cli