summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChase Sterling <chase.sterling@gmail.com>2022-01-25 00:10:57 -0500
committerCalum Lind <calumlind+deluge@gmail.com>2022-01-26 18:44:46 +0000
commita73e01f89f036894c467bb49708be557f4ebf7a7 (patch)
tree0e2e22efdaeac274863938155acf1d1573a0bff5
parent87ec04af16988c12edf425674938403da4ec7871 (diff)
downloaddeluge-a73e01f89f036894c467bb49708be557f4ebf7a7.tar.gz
deluge-a73e01f89f036894c467bb49708be557f4ebf7a7.tar.bz2
deluge-a73e01f89f036894c467bb49708be557f4ebf7a7.zip
[Tests] Fix maketorrent test on Windows
-rw-r--r--deluge/tests/test_maketorrent.py26
1 files changed, 10 insertions, 16 deletions
diff --git a/deluge/tests/test_maketorrent.py b/deluge/tests/test_maketorrent.py
index 90ca61a3c..76239b82c 100644
--- a/deluge/tests/test_maketorrent.py
+++ b/deluge/tests/test_maketorrent.py
@@ -10,7 +10,6 @@ import tempfile
from twisted.trial import unittest
from deluge import maketorrent
-from deluge.common import windows_check
def check_torrent(filename):
@@ -51,21 +50,16 @@ class MakeTorrentTestCase(unittest.TestCase):
os.remove(tmp_file)
def test_save_singlefile(self):
- if windows_check():
- raise unittest.SkipTest('on windows file not released')
- tmp_data = tempfile.mkstemp('testdata')[1]
- with open(tmp_data, 'wb') as _file:
- _file.write(b'a' * (2314 * 1024))
- t = maketorrent.TorrentMetadata()
- t.data_path = tmp_data
- tmp_fd, tmp_file = tempfile.mkstemp('.torrent')
- t.save(tmp_file)
-
- check_torrent(tmp_file)
-
- os.remove(tmp_data)
- os.close(tmp_fd)
- os.remove(tmp_file)
+ with tempfile.TemporaryDirectory() as tmp_dir:
+ tmp_data = tmp_dir + '/data'
+ with open(tmp_data, 'wb') as _file:
+ _file.write(b'a' * (2314 * 1024))
+ t = maketorrent.TorrentMetadata()
+ t.data_path = tmp_data
+ tmp_file = tmp_dir + '/.torrent'
+ t.save(tmp_file)
+
+ check_torrent(tmp_file)
def test_save_multifile_padded(self):
# Create a temporary folder for torrent creation