Use os.linesep instead of \n

This commit is contained in:
Twangboy 2025-01-16 15:17:17 -07:00 committed by Daniel Wozniak
parent 1a97786516
commit 30e2d9aaf4

View file

@ -7,6 +7,7 @@ import pytest
import salt.utils.files import salt.utils.files
import salt.utils.platform import salt.utils.platform
import salt.utils.stringutils
from tests.support.case import ModuleCase from tests.support.case import ModuleCase
from tests.support.helpers import requires_system_grains from tests.support.helpers import requires_system_grains
from tests.support.runtests import RUNTIME_VARS from tests.support.runtests import RUNTIME_VARS
@ -199,7 +200,7 @@ class FileModuleTest(ModuleCase):
assert ret["retcode"] == 0, repr(ret) assert ret["retcode"] == 0, repr(ret)
with salt.utils.files.fopen(src_file) as fp: with salt.utils.files.fopen(src_file) as fp:
self.assertEqual( self.assertEqual(
salt.utils.stringutils.to_unicode(fp.read()), "Hello world\n" salt.utils.stringutils.to_unicode(fp.read()), f"Hello world{os.linesep}"
) )
def test_remove_file(self): def test_remove_file(self):