mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-03 07:03:39 +00:00
[Tests] Fix maketorrent test on Windows
This commit is contained in:
parent
87ec04af16
commit
a73e01f89f
@ -10,7 +10,6 @@ import tempfile
|
|||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
|
|
||||||
from deluge import maketorrent
|
from deluge import maketorrent
|
||||||
from deluge.common import windows_check
|
|
||||||
|
|
||||||
|
|
||||||
def check_torrent(filename):
|
def check_torrent(filename):
|
||||||
@ -51,21 +50,16 @@ class MakeTorrentTestCase(unittest.TestCase):
|
|||||||
os.remove(tmp_file)
|
os.remove(tmp_file)
|
||||||
|
|
||||||
def test_save_singlefile(self):
|
def test_save_singlefile(self):
|
||||||
if windows_check():
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||||
raise unittest.SkipTest('on windows file not released')
|
tmp_data = tmp_dir + '/data'
|
||||||
tmp_data = tempfile.mkstemp('testdata')[1]
|
with open(tmp_data, 'wb') as _file:
|
||||||
with open(tmp_data, 'wb') as _file:
|
_file.write(b'a' * (2314 * 1024))
|
||||||
_file.write(b'a' * (2314 * 1024))
|
t = maketorrent.TorrentMetadata()
|
||||||
t = maketorrent.TorrentMetadata()
|
t.data_path = tmp_data
|
||||||
t.data_path = tmp_data
|
tmp_file = tmp_dir + '/.torrent'
|
||||||
tmp_fd, tmp_file = tempfile.mkstemp('.torrent')
|
t.save(tmp_file)
|
||||||
t.save(tmp_file)
|
|
||||||
|
|
||||||
check_torrent(tmp_file)
|
check_torrent(tmp_file)
|
||||||
|
|
||||||
os.remove(tmp_data)
|
|
||||||
os.close(tmp_fd)
|
|
||||||
os.remove(tmp_file)
|
|
||||||
|
|
||||||
def test_save_multifile_padded(self):
|
def test_save_multifile_padded(self):
|
||||||
# Create a temporary folder for torrent creation
|
# Create a temporary folder for torrent creation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user