mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Fix test_rendering_includes for Windows
This commit is contained in:
parent
89635b4467
commit
f43445d3de
@ -23,26 +23,40 @@ class PyDSLRendererIncludeTestCase(integration.ModuleCase):
|
||||
inability to load custom modules inside the pydsl renderers. This
|
||||
is a FIXME.
|
||||
'''
|
||||
try:
|
||||
self.run_function('state.sls', ['pydsl.aaa'])
|
||||
self.run_function('state.sls', ['pydsl.aaa'])
|
||||
|
||||
expected = textwrap.dedent('''\
|
||||
X1
|
||||
X2
|
||||
X3
|
||||
Y1 extended
|
||||
Y2 extended
|
||||
Y3
|
||||
hello red 1
|
||||
hello green 2
|
||||
hello blue 3
|
||||
''')
|
||||
expected = textwrap.dedent('''\
|
||||
X1
|
||||
X2
|
||||
X3
|
||||
Y1 extended
|
||||
Y2 extended
|
||||
Y3
|
||||
hello red 1
|
||||
hello green 2
|
||||
hello blue 3
|
||||
''')
|
||||
|
||||
with salt.utils.fopen('/tmp/output', 'r') as f:
|
||||
self.assertEqual(sorted(f.read()), sorted(expected))
|
||||
# Windows adds `linefeed` in addition to `newline`. There's also an
|
||||
# unexplainable space before the `linefeed`...
|
||||
if salt.utils.is_windows():
|
||||
expected = 'X1 \r\n' \
|
||||
'X2 \r\n' \
|
||||
'X3 \r\n' \
|
||||
'Y1 extended \r\n' \
|
||||
'Y2 extended \r\n' \
|
||||
'Y3 \r\n' \
|
||||
'hello red 1 \r\n' \
|
||||
'hello green 2 \r\n' \
|
||||
'hello blue 3 \r\n'
|
||||
|
||||
with salt.utils.fopen('/tmp/output', 'r') as f:
|
||||
ret = f.read()
|
||||
|
||||
os.remove('/tmp/output')
|
||||
|
||||
self.assertEqual(sorted(ret), sorted(expected))
|
||||
|
||||
finally:
|
||||
os.remove('/tmp/output')
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
|
Loading…
Reference in New Issue
Block a user