Fix TEST_REWRITE
This commit is contained in:
parent
8ae4687cf2
commit
7e9af1fe35
@ -35,9 +35,7 @@ class BuildScript(Script):
|
||||
if cmd.startswith('sudo '):
|
||||
_cmd = _cmd[5:]
|
||||
|
||||
if '\n' in _cmd.strip():
|
||||
# 1337: multiline supports, kindof breaks sudo but really fixes cd
|
||||
_cmd = ' '.join(['bash -eux <<__EOF\n', _cmd, '\n__EOF'])
|
||||
_cmd = ' '.join(['bash -eux <<__EOF\n', _cmd.strip(), '\n__EOF'])
|
||||
|
||||
if cmd.startswith('sudo '):
|
||||
return f'buildah run --user root $ctr -- {_cmd}'
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user