mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fopen does not support encoding
This commit is contained in:
parent
487161ba8f
commit
e8362adf71
1 changed files with 4 additions and 4 deletions
|
@ -93,9 +93,9 @@ class GitModuleTest(ModuleCase):
|
|||
dir_path = os.path.join(self.repo, dirname)
|
||||
_makedirs(dir_path)
|
||||
for filename in self.files:
|
||||
with salt.utils.files.fopen(os.path.join(dir_path, filename), 'w', encoding='utf-8') as fp_:
|
||||
with salt.utils.files.fopen(os.path.join(dir_path, filename), 'wb') as fp_:
|
||||
fp_.write(
|
||||
'This is a test file named {0}.'.format(filename)
|
||||
'This is a test file named {0}.'.format(filename).encode('utf-8')
|
||||
)
|
||||
# Navigate to the root of the repo to init, stage, and commit
|
||||
os.chdir(self.repo)
|
||||
|
@ -166,9 +166,9 @@ class GitModuleTest(ModuleCase):
|
|||
files = [os.path.join(newdir_path, x) for x in self.files]
|
||||
files_relpath = [os.path.join(newdir, x) for x in self.files]
|
||||
for path in files:
|
||||
with salt.utils.files.fopen(path, 'w', encoding='utf-8') as fp_:
|
||||
with salt.utils.files.fopen(path, 'wb') as fp_:
|
||||
fp_.write(
|
||||
'This is a test file with relative path {0}.\n'.format(path)
|
||||
'This is a test file with relative path {0}.\n'.format(path).encode('utf-8')
|
||||
)
|
||||
ret = self.run_function('git.add', [self.repo, newdir])
|
||||
res = '\n'.join(sorted(['add \'{0}\''.format(x) for x in files_relpath]))
|
||||
|
|
Loading…
Add table
Reference in a new issue