mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #45536 from twangboy/win_fix_test_configparser
Fix `unit.utils.test_configparser` for Windows
This commit is contained in:
commit
061c7e3bcb
@ -74,7 +74,11 @@ class GitConfigParser(RawConfigParser, object): # pylint: disable=undefined-var
|
|||||||
while True:
|
while True:
|
||||||
line = fp.readline()
|
line = fp.readline()
|
||||||
if six.PY2:
|
if six.PY2:
|
||||||
line = line.decode(__salt_system_encoding__)
|
try:
|
||||||
|
line = line.decode(__salt_system_encoding__)
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
# Fall back to UTF-8
|
||||||
|
line = line.decode('utf-8')
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
lineno = lineno + 1
|
lineno = lineno + 1
|
||||||
|
@ -71,7 +71,7 @@ class TestGitConfigParser(TestCase):
|
|||||||
with salt.utils.files.fopen(self.orig_config, 'wb') as fp_:
|
with salt.utils.files.fopen(self.orig_config, 'wb') as fp_:
|
||||||
fp_.write(
|
fp_.write(
|
||||||
salt.utils.stringutils.to_bytes(
|
salt.utils.stringutils.to_bytes(
|
||||||
'\n'.join(ORIG_CONFIG)
|
os.linesep.join(ORIG_CONFIG)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.conf = salt.utils.configparser.GitConfigParser()
|
self.conf = salt.utils.configparser.GitConfigParser()
|
||||||
|
Loading…
Reference in New Issue
Block a user