summaryrefslogtreecommitdiffstats
path: root/deluge/tests/test_files_tab.py
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/tests/test_files_tab.py')
-rw-r--r--deluge/tests/test_files_tab.py66
1 files changed, 26 insertions, 40 deletions
diff --git a/deluge/tests/test_files_tab.py b/deluge/tests/test_files_tab.py
index 1ec8e18de..1e97cbbc3 100644
--- a/deluge/tests/test_files_tab.py
+++ b/deluge/tests/test_files_tab.py
@@ -1,23 +1,16 @@
-# -*- coding: utf-8 -*-
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import pytest
-from twisted.trial import unittest
import deluge.component as component
-from deluge.common import windows_check
from deluge.configmanager import ConfigManager
+from deluge.conftest import BaseTestCase
from deluge.i18n import setup_translation
-from . import common
-from .basetest import BaseTestCase
-
libs_available = True
# Allow running other tests without GTKUI dependencies available
try:
@@ -32,12 +25,11 @@ setup_translation()
@pytest.mark.gtkui
-class FilesTabTestCase(BaseTestCase):
+class TestFilesTab(BaseTestCase):
def set_up(self):
if libs_available is False:
- raise unittest.SkipTest('GTKUI dependencies not available')
+ pytest.skip('GTKUI dependencies not available')
- common.set_tmp_config_dir()
ConfigManager('gtk3ui.conf', defaults=DEFAULT_PREFS)
self.mainwindow = MainWindow()
self.filestab = FilesTab()
@@ -52,8 +44,8 @@ class FilesTabTestCase(BaseTestCase):
root = treestore.get_iter_first()
level = 1
- def p_level(s, l):
- print('%s%s' % (' ' * l, s))
+ def p_level(s, lvl):
+ print('{}{}'.format(' ' * lvl, s))
def _print_treestore_children(i, lvl):
while i:
@@ -98,80 +90,74 @@ class FilesTabTestCase(BaseTestCase):
)
if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore)
- self.assertTrue(ret)
+ assert ret
def test_files_tab2(self):
- if windows_check():
- raise unittest.SkipTest('on windows \\ != / for path names')
self.filestab.files_list[self.t_id] = (
- {'index': 0, 'path': '1/1/test_10.txt', 'offset': 0, 'size': 13},
- {'index': 1, 'path': 'test_100.txt', 'offset': 13, 'size': 14},
+ {'index': 0, 'path': '1/1/test_100.txt', 'offset': 0, 'size': 13},
+ {'index': 1, 'path': 'test_101.txt', 'offset': 13, 'size': 14},
)
self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event(
- self.t_id, self.index, '1/1/test_100.txt'
+ self.t_id, self.index, '1/1/test_101.txt'
)
ret = self.verify_treestore(
self.filestab.treestore,
- [['1/', [['1/', [['test_100.txt'], ['test_10.txt']]]]]],
+ [['1/', [['1/', [['test_100.txt'], ['test_101.txt']]]]]],
)
if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore)
- self.assertTrue(ret)
+ assert ret
def test_files_tab3(self):
- if windows_check():
- raise unittest.SkipTest('on windows \\ != / for path names')
self.filestab.files_list[self.t_id] = (
- {'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13},
- {'index': 1, 'path': 'test_100.txt', 'offset': 13, 'size': 14},
+ {'index': 0, 'path': '1/test_100.txt', 'offset': 0, 'size': 13},
+ {'index': 1, 'path': 'test_101.txt', 'offset': 13, 'size': 14},
)
self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event(
- self.t_id, self.index, '1/test_100.txt'
+ self.t_id, self.index, '1/test_101.txt'
)
ret = self.verify_treestore(
- self.filestab.treestore, [['1/', [['test_100.txt'], ['test_10.txt']]]]
+ self.filestab.treestore, [['1/', [['test_100.txt'], ['test_101.txt']]]]
)
if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore)
- self.assertTrue(ret)
+ assert ret
def test_files_tab4(self):
self.filestab.files_list[self.t_id] = (
- {'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13},
- {'index': 1, 'path': '1/test_100.txt', 'offset': 13, 'size': 14},
+ {'index': 0, 'path': '1/test_100.txt', 'offset': 0, 'size': 13},
+ {'index': 1, 'path': '1/test_101.txt', 'offset': 13, 'size': 14},
)
self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event(
- self.t_id, self.index, '1/2/test_100.txt'
+ self.t_id, self.index, '1/2/test_101.txt'
)
ret = self.verify_treestore(
self.filestab.treestore,
- [['1/', [['2/', [['test_100.txt']]], ['test_10.txt']]]],
+ [['1/', [['2/', [['test_101.txt']]], ['test_100.txt']]]],
)
if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore)
- self.assertTrue(ret)
+ assert ret
def test_files_tab5(self):
- if windows_check():
- raise unittest.SkipTest('on windows \\ != / for path names')
self.filestab.files_list[self.t_id] = (
- {'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13},
- {'index': 1, 'path': '2/test_100.txt', 'offset': 13, 'size': 14},
+ {'index': 0, 'path': '1/test_100.txt', 'offset': 0, 'size': 13},
+ {'index': 1, 'path': '2/test_101.txt', 'offset': 13, 'size': 14},
)
self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event(
- self.t_id, self.index, '1/test_100.txt'
+ self.t_id, self.index, '1/test_101.txt'
)
ret = self.verify_treestore(
- self.filestab.treestore, [['1/', [['test_100.txt'], ['test_10.txt']]]]
+ self.filestab.treestore, [['1/', [['test_100.txt'], ['test_101.txt']]]]
)
if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore)
- self.assertTrue(ret)
+ assert ret