From af2bed8a0f27adaa4d8ee3fcd792d9468af4920e Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sat, 28 Jul 2018 17:17:57 +0100 Subject: [PATCH] [Py2to3] Fix tests for maketorrent and metafile --- deluge/tests/test_maketorrent.py | 8 ++++---- deluge/tests/test_metafile.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/deluge/tests/test_maketorrent.py b/deluge/tests/test_maketorrent.py index 9f5e8379f..01ce4ee1f 100644 --- a/deluge/tests/test_maketorrent.py +++ b/deluge/tests/test_maketorrent.py @@ -31,11 +31,11 @@ class MakeTorrentTestCase(unittest.TestCase): # Create a temporary folder for torrent creation tmp_path = tempfile.mkdtemp() with open(os.path.join(tmp_path, 'file_A'), 'wb') as _file: - _file.write('a' * (312 * 1024)) + _file.write(b'a' * (312 * 1024)) with open(os.path.join(tmp_path, 'file_B'), 'wb') as _file: - _file.write('b' * (2354 * 1024)) + _file.write(b'b' * (2354 * 1024)) with open(os.path.join(tmp_path, 'file_C'), 'wb') as _file: - _file.write('c' * (11 * 1024)) + _file.write(b'c' * (11 * 1024)) t = maketorrent.TorrentMetadata() t.data_path = tmp_path @@ -56,7 +56,7 @@ class MakeTorrentTestCase(unittest.TestCase): raise unittest.SkipTest('on windows file not released') tmp_data = tempfile.mkstemp('testdata')[1] with open(tmp_data, 'wb') as _file: - _file.write('a' * (2314 * 1024)) + _file.write(b'a' * (2314 * 1024)) t = maketorrent.TorrentMetadata() t.data_path = tmp_data tmp_fd, tmp_file = tempfile.mkstemp('.torrent') diff --git a/deluge/tests/test_metafile.py b/deluge/tests/test_metafile.py index d61d61015..4a41a50ce 100644 --- a/deluge/tests/test_metafile.py +++ b/deluge/tests/test_metafile.py @@ -31,11 +31,11 @@ class MetafileTestCase(unittest.TestCase): # Create a temporary folder for torrent creation tmp_path = tempfile.mkdtemp() with open(os.path.join(tmp_path, 'file_A'), 'wb') as tmp_file: - tmp_file.write('a' * (312 * 1024)) + tmp_file.write(b'a' * (312 * 1024)) with open(os.path.join(tmp_path, 'file_B'), 'wb') as tmp_file: - tmp_file.write('b' * (2354 * 1024)) + tmp_file.write(b'b' * (2354 * 1024)) with open(os.path.join(tmp_path, 'file_C'), 'wb') as tmp_file: - tmp_file.write('c' * (11 * 1024)) + tmp_file.write(b'c' * (11 * 1024)) tmp_fd, tmp_file = tempfile.mkstemp('.torrent') metafile.make_meta_file(tmp_path, '', 32768, target=tmp_file) @@ -54,7 +54,7 @@ class MetafileTestCase(unittest.TestCase): raise unittest.SkipTest('on windows \ != / for path names') tmp_path = tempfile.mkstemp('testdata')[1] with open(tmp_path, 'wb') as tmp_file: - tmp_file.write('a' * (2314 * 1024)) + tmp_file.write(b'a' * (2314 * 1024)) tmp_fd, tmp_file = tempfile.mkstemp('.torrent') metafile.make_meta_file(tmp_path, '', 32768, target=tmp_file)