Fix mistakes in test code
This commit is contained in:
parent
ae0b070c1b
commit
1fa2de066f
|
@ -241,18 +241,19 @@ import deluge.core.daemon_entry
|
|||
from deluge.common import windows_check
|
||||
|
||||
if windows_check():
|
||||
sys.argv.extend(['-c', '%s', '-L', 'info', '-p', '%d'])
|
||||
else
|
||||
sys.argv.extend(['-d', '-c', '%s', '-L', 'info', '-p', '%d'])
|
||||
sys.argv.extend(['-c', '%(dir)s', '-L', 'info', '-p', '%(port)d'])
|
||||
else:
|
||||
sys.argv.extend(['-d', '-c', '%(dir)s', '-L', 'info', '-p', '%(port)d'])
|
||||
|
||||
try:
|
||||
daemon = deluge.core.daemon_entry.start_daemon(skip_start=True)
|
||||
%s
|
||||
%(script)s
|
||||
daemon.start()
|
||||
except Exception:
|
||||
import traceback
|
||||
sys.stderr.write('Exception raised:\\n %%s' %% traceback.format_exc())
|
||||
""" % (config_directory, listen_port, custom_script)
|
||||
""" % {'dir': config_directory, 'port': listen_port, 'script': custom_script}
|
||||
|
||||
callbacks = []
|
||||
default_core_cb = {'deferred': Deferred(), 'types': 'stdout'}
|
||||
if timeout:
|
||||
|
|
|
@ -21,7 +21,7 @@ from . import common
|
|||
|
||||
class DaemonBase(object):
|
||||
|
||||
if windows_check:
|
||||
if windows_check():
|
||||
skip = 'windows cant start_core not enough arguments for format string'
|
||||
|
||||
def common_set_up(self):
|
||||
|
|
|
@ -18,8 +18,8 @@ class BencodeTestCase(unittest.TestCase):
|
|||
def test_bencode_unicode_metainfo(self):
|
||||
filename = common.get_test_data_file('test.torrent')
|
||||
with open(filename, 'rb') as _file:
|
||||
metainfo = bencode.bdecode(_file.read())['info']
|
||||
metainfo = bencode.bdecode(_file.read())[b'info']
|
||||
bencode.bencode({b'info': metainfo})
|
||||
|
||||
def test_bencode_unicode_value(self):
|
||||
self.assertEqual(bencode.bencode('abc'), '3:abc')
|
||||
self.assertEqual(bencode.bencode('abc'), b'3:abc')
|
||||
|
|
|
@ -77,7 +77,7 @@ class NoVersionSendingClient(Client):
|
|||
|
||||
class ClientTestCase(BaseTestCase, DaemonBase):
|
||||
|
||||
if windows_check:
|
||||
if windows_check():
|
||||
skip = 'windows cant start_core not enough arguments for format string'
|
||||
|
||||
def set_up(self):
|
||||
|
|
|
@ -153,7 +153,7 @@ class CoreTestCase(BaseTestCase):
|
|||
# Get the info hash from the test.torrent
|
||||
from deluge.bencode import bdecode, bencode
|
||||
with open(filename, 'rb') as _file:
|
||||
info_hash = sha(bencode(bdecode(_file.read())['info'])).hexdigest()
|
||||
info_hash = sha(bencode(bdecode(_file.read())[b'info'])).hexdigest()
|
||||
self.assertEqual(torrent_id, info_hash)
|
||||
|
||||
def test_add_torrent_file_invalid_filedump(self):
|
||||
|
|
Loading…
Reference in New Issue