Fix TEST_REWRITE

This commit is contained in:
jpic
2020-01-31 21:50:41 +01:00
parent 8ae4687cf2
commit 7e9af1fe35
2 changed files with 5 additions and 5 deletions
+4 -2
View File
@@ -27,12 +27,14 @@ def script_test(name, *visitors):
f'test_{name}.sh',
)
if os.getenv('TEST_REWRITE') and os.path.exists(path):
os.unlink(path)
if not os.path.exists(path):
with open(path, 'w+') as f:
f.write(result)
raise Exception(f'Fixture created test_{name}.sh')
elif os.getenv('TEST_REWRITE') and os.path.exists(path):
os.unlink(path)
with open(path, 'r') as f:
expected = f.read()
result = difflib.unified_diff(