未验证 提交 0d9c063c 编写于 作者: L Lukáš Doktor

Merging pull request 2133

Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>

* https://github.com/avocado-framework/avocado:
  Fix byte vs string file io for python 3
......@@ -27,7 +27,8 @@ class ArchiveTest(unittest.TestCase):
compressdir = self.compressdir
str_length = self.sys_random.randint(30, 50)
fd, filename = tempfile.mkstemp(dir=compressdir, text=True)
os.write(fd, data_factory.generate_random_string(str_length))
with os.fdopen(fd, 'w') as f:
f.write(data_factory.generate_random_string(str_length))
relative_path = filename.replace(self.compressdir, '')
hash_map_1[relative_path] = crypto.hash_file(filename)
......@@ -47,7 +48,8 @@ class ArchiveTest(unittest.TestCase):
def compress_and_check_file(self, extension):
str_length = self.sys_random.randint(30, 50)
fd, filename = tempfile.mkstemp(dir=self.basedir, text=True)
os.write(fd, data_factory.generate_random_string(str_length))
with os.fdopen(fd, 'w') as f:
f.write(data_factory.generate_random_string(str_length))
original_hash = crypto.hash_file(filename)
dstfile = filename + extension
archive_filename = os.path.join(self.basedir, dstfile)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册