Fix test?

This commit is contained in:
Aaron Lichtman 2019-11-16 14:46:34 +01:00
parent c23efa7f80
commit bca12b4b16
No known key found for this signature in database
GPG key ID: 22368077DE9F9903

View file

@ -67,7 +67,7 @@ def set_config(context, config_file):
cf.write("version: {}".format(__version__))
@when('we open the editor and enter nothing')
@when('we open the editor and enter ""')
@when('we open the editor and enter "{text}"')
def open_editor_and_enter(context, text=""):
text = (text or context.text)
@ -77,7 +77,10 @@ def open_editor_and_enter(context, text=""):
tmpfile = command[-1]
print("TMPFILE:", tmpfile)
with open(tmpfile, "w+") as f:
f.write(text)
if text is not None:
f.write(text)
else:
f.write("")
print("File contents:", open(tmpfile, "r").read())
return tmpfile