mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix py3 os.linesep wart
This commit is contained in:
parent
3c565d7e54
commit
46fa2c04de
1 changed files with 4 additions and 3 deletions
|
@ -44,6 +44,7 @@ except ImportError:
|
|||
HAS_TIMELIB = False
|
||||
|
||||
TEMPLATES_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
BLINESEP = salt.utils.to_bytes(os.linesep)
|
||||
|
||||
|
||||
class MockFileClient(object):
|
||||
|
@ -69,10 +70,10 @@ def _setup_test_dir(src_dir, test_dir):
|
|||
salt.utils.files.recursive_copy(src_dir, test_dir)
|
||||
filename = os.path.join(test_dir, 'non_ascii')
|
||||
with salt.utils.fopen(filename, 'wb') as fp:
|
||||
fp.write(b'Assun\xc3\xa7\xc3\xa3o' + os.linesep)
|
||||
fp.write(b'Assun\xc3\xa7\xc3\xa3o' + BLINESEP)
|
||||
filename = os.path.join(test_dir, 'hello_simple')
|
||||
with salt.utils.fopen(filename, 'wb') as fp:
|
||||
fp.write(b'world' + os.linesep)
|
||||
fp.write(b'world' + BLINESEP)
|
||||
filename = os.path.join(test_dir, 'hello_import')
|
||||
lines = [
|
||||
r"{% from 'macro' import mymacro -%}",
|
||||
|
@ -81,7 +82,7 @@ def _setup_test_dir(src_dir, test_dir):
|
|||
]
|
||||
with salt.utils.fopen(filename, 'wb') as fp:
|
||||
for line in lines:
|
||||
fp.write(line.encode('utf-8') + os.linesep)
|
||||
fp.write(line.encode('utf-8') + BLINESEP)
|
||||
|
||||
|
||||
class TestSaltCacheLoader(TestCase):
|
||||
|
|
Loading…
Add table
Reference in a new issue