summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChase Sterling <chase.sterling@gmail.com>2022-01-25 11:37:09 -0500
committerCalum Lind <calumlind+deluge@gmail.com>2022-01-26 18:44:46 +0000
commitfffc6ab7d73786d1a4075eab0d14e65e18de023f (patch)
treea42ae2c185479b94e808f7dc14b9d3c299fcae83
parenta73e01f89f036894c467bb49708be557f4ebf7a7 (diff)
downloaddeluge-fffc6ab7d73786d1a4075eab0d14e65e18de023f.tar.gz
deluge-fffc6ab7d73786d1a4075eab0d14e65e18de023f.tar.bz2
deluge-fffc6ab7d73786d1a4075eab0d14e65e18de023f.zip
[Tests] Enable metafile test on Windows
-rw-r--r--deluge/tests/test_metafile.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/deluge/tests/test_metafile.py b/deluge/tests/test_metafile.py
index af8f72d40..5aa1400a7 100644
--- a/deluge/tests/test_metafile.py
+++ b/deluge/tests/test_metafile.py
@@ -10,7 +10,6 @@ import tempfile
from twisted.trial import unittest
from deluge import metafile
-from deluge.common import windows_check
def check_torrent(filename):
@@ -49,17 +48,12 @@ class MetafileTestCase(unittest.TestCase):
os.remove(tmp_file)
def test_save_singlefile(self):
- if windows_check():
- 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(b'a' * (2314 * 1024))
+ with tempfile.TemporaryDirectory() as tmp_dir:
+ tmp_data = tmp_dir + '/testdata'
+ with open(tmp_data, 'wb') as tmp_file:
+ tmp_file.write(b'a' * (2314 * 1024))
- tmp_fd, tmp_file = tempfile.mkstemp('.torrent')
- metafile.make_meta_file(tmp_path, '', 32768, target=tmp_file)
-
- check_torrent(tmp_file)
+ tmp_torrent = tmp_dir + '/.torrent'
+ metafile.make_meta_file(tmp_data, '', 32768, target=tmp_torrent)
- os.remove(tmp_path)
- os.close(tmp_fd)
- os.remove(tmp_file)
+ check_torrent(tmp_torrent)