mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 12:04:10 +00:00
[Py2to3] Fix tests for maketorrent and metafile
This commit is contained in:
parent
b93e868048
commit
af2bed8a0f
@ -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')
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user