Add TEST_REWRITE env var to rewrite tests

This commit is contained in:
jpic 2020-01-31 19:28:09 +01:00
parent 3515dd2590
commit 9eb0f5ffaa

View File

@ -30,6 +30,8 @@ def script_test(name, *visitors):
with open(path, 'w+') as f: with open(path, 'w+') as f:
f.write(result) f.write(result)
raise Exception(f'Fixture created test_{name}.sh') 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: with open(path, 'r') as f:
expected = f.read() expected = f.read()
result = difflib.unified_diff( result = difflib.unified_diff(