mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 03:55:43 +00:00
[Tests] Changes to tests and test configs of Travis/tox
* Added pip chaching * Added disable_new_release_check to tracker icons tests * Fixed test_torrentview * Require minimum tox version 1.8 * Fixed GTKUI tests and testcoverage by using xvfb on travis * Separated the apt dependencies for commands requiering GTKUI deps
This commit is contained in:
parent
8334bf9477
commit
448261394f
45
.travis.yml
45
.travis.yml
@ -1,37 +1,50 @@
|
||||
language: python
|
||||
|
||||
python:
|
||||
# - "2.6"
|
||||
- "2.7"
|
||||
|
||||
# command to install dependencies
|
||||
install:
|
||||
- pip install tox
|
||||
# Cache packages download with apt
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.pip-cache/
|
||||
|
||||
before_install:
|
||||
- lsb_release -a
|
||||
- sudo add-apt-repository ppa:deluge-team/ppa -y
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install python-libtorrent
|
||||
|
||||
script:
|
||||
- tox
|
||||
# command to install dependencies
|
||||
install:
|
||||
- bash -c "echo $APTPACKAGES"
|
||||
- sudo apt-get install $APTPACKAGES
|
||||
- pip install "tox>=1.8" --download-cache $HOME/.pip-cache
|
||||
|
||||
env:
|
||||
- TOX_ENV=pydef
|
||||
- TOX_ENV=trial
|
||||
- TOX_ENV=todo
|
||||
# - TOX_ENV=plugins
|
||||
- TOX_ENV=flake8
|
||||
- TOX_ENV=flake8-complexity
|
||||
- TOX_ENV=isort
|
||||
- TOX_ENV=docs
|
||||
- TOX_ENV=testcoverage
|
||||
global:
|
||||
- PIP_DOWNLOAD_CACHE=$HOME/.pip-cache/
|
||||
- APTPACKAGES="python-libtorrent"
|
||||
- APTPACKAGES_GTKUI="python-gobject python-glade2"
|
||||
matrix:
|
||||
- TOX_ENV=pydef
|
||||
- TOX_ENV=flake8
|
||||
- TOX_ENV=flake8-complexity
|
||||
- TOX_ENV=isort
|
||||
- TOX_ENV=docs
|
||||
- TOX_ENV=todo
|
||||
- TOX_ENV=trial APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
|
||||
- TOX_ENV=pygtkui APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
|
||||
- TOX_ENV=testcoverage APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
|
||||
# - TOX_ENV=plugins
|
||||
|
||||
virtualenv:
|
||||
system_site_packages: true
|
||||
|
||||
# We use xvfb for the GTKUI tests
|
||||
before_script:
|
||||
- export PYTHONPATH=$PYTHONPATH:$PWD
|
||||
- python -c "import libtorrent as lt; print lt.version"
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
|
||||
script:
|
||||
- tox -e $TOX_ENV
|
||||
|
@ -1,13 +1,18 @@
|
||||
from twisted.trial import unittest
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.core.authmanager import AUTH_LEVEL_ADMIN, AuthManager
|
||||
|
||||
from .basetest import BaseTestCase
|
||||
|
||||
class AuthManagerTestCase(unittest.TestCase):
|
||||
def setUp(self): # NOQA
|
||||
|
||||
class AuthManagerTestCase(BaseTestCase):
|
||||
def set_up(self):
|
||||
self.auth = AuthManager()
|
||||
self.auth.start()
|
||||
|
||||
def tear_down(self):
|
||||
# We must ensure that the components in component registry are removed
|
||||
return component.shutdown()
|
||||
|
||||
def test_authorize(self):
|
||||
from deluge.ui import common
|
||||
self.assertEquals(
|
||||
|
@ -1,12 +1,13 @@
|
||||
from twisted.internet import defer
|
||||
from twisted.internet.error import CannotListenError
|
||||
from twisted.trial import unittest
|
||||
|
||||
import deluge.component as component
|
||||
from deluge import error
|
||||
from deluge.core.authmanager import AUTH_LEVEL_ADMIN
|
||||
from deluge.ui.client import Client, DaemonSSLProxy, client
|
||||
|
||||
from . import common
|
||||
from .basetest import BaseTestCase
|
||||
|
||||
|
||||
class NoVersionSendingDaemonSSLProxy(DaemonSSLProxy):
|
||||
@ -63,9 +64,9 @@ class NoVersionSendingClient(Client):
|
||||
self.disconnect_callback()
|
||||
|
||||
|
||||
class ClientTestCase(unittest.TestCase):
|
||||
class ClientTestCase(BaseTestCase):
|
||||
|
||||
def setUp(self): # NOQA
|
||||
def set_up(self):
|
||||
self.listen_port = 58846
|
||||
tries = 10
|
||||
error = None
|
||||
@ -82,8 +83,9 @@ class ClientTestCase(unittest.TestCase):
|
||||
if error:
|
||||
raise error
|
||||
|
||||
def tearDown(self): # NOQA
|
||||
def tear_down(self):
|
||||
self.core.terminate()
|
||||
return component.shutdown()
|
||||
|
||||
def test_connect_no_credentials(self):
|
||||
d = client.connect(
|
||||
|
@ -1,16 +1,28 @@
|
||||
import pytest
|
||||
import gobject
|
||||
from twisted.trial import unittest
|
||||
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.ui.gtkui.mainwindow import MainWindow
|
||||
from deluge.ui.gtkui.menubar import MenuBar
|
||||
from deluge.ui.gtkui.torrentdetails import TorrentDetails
|
||||
from deluge.ui.gtkui.torrentview import TorrentView
|
||||
from deluge.configmanager import ConfigManager
|
||||
|
||||
from . import common
|
||||
from .basetest import BaseTestCase
|
||||
|
||||
libs_available = True
|
||||
# Allow running other tests without GTKUI dependencies available
|
||||
try:
|
||||
from gobject import TYPE_UINT64
|
||||
from deluge.ui.gtkui.mainwindow import MainWindow
|
||||
from deluge.ui.gtkui.menubar import MenuBar
|
||||
from deluge.ui.gtkui.torrentdetails import TorrentDetails
|
||||
from deluge.ui.gtkui.torrentview import TorrentView
|
||||
from deluge.ui.gtkui.gtkui import DEFAULT_PREFS
|
||||
except ImportError as err:
|
||||
libs_available = False
|
||||
TYPE_UINT64 = "Whatever"
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
deluge.common.setup_translations()
|
||||
|
||||
|
||||
@ -23,13 +35,19 @@ class TorrentviewTestCase(BaseTestCase):
|
||||
u'Up Speed', u'Down Limit', u'Up Limit', u'ETA', u'Ratio',
|
||||
u'Avail', u'Added', u'Completed', u'Complete Seen',
|
||||
u'Tracker', u'Download Folder', u'Owner', u'Shared']
|
||||
default_liststore_columns = [bool, str, bool, int, str, str, gobject.TYPE_UINT64,
|
||||
gobject.TYPE_UINT64, gobject.TYPE_UINT64, gobject.TYPE_UINT64,
|
||||
default_liststore_columns = [bool, str, bool, int, str, str, TYPE_UINT64,
|
||||
TYPE_UINT64, TYPE_UINT64, TYPE_UINT64,
|
||||
float, str, int, int, int, int, float, float, float,
|
||||
float, float, int, float, float, float, float,
|
||||
float, str, str, str, str, bool]
|
||||
|
||||
def set_up(self):
|
||||
if libs_available is False:
|
||||
raise unittest.SkipTest("GTKUI dependencies not available")
|
||||
|
||||
common.set_tmp_config_dir()
|
||||
# MainWindow loads this config file, so lets make sure it contains the defaults
|
||||
ConfigManager("gtkui.conf", defaults=DEFAULT_PREFS)
|
||||
self.mainwindow = MainWindow()
|
||||
self.torrentview = TorrentView()
|
||||
self.torrentdetails = TorrentDetails()
|
||||
|
@ -4,12 +4,13 @@ import deluge.component as component
|
||||
import deluge.ui.tracker_icons
|
||||
from deluge.ui.tracker_icons import TrackerIcon, TrackerIcons
|
||||
|
||||
from . import common
|
||||
from .basetest import BaseTestCase
|
||||
from .common import set_tmp_config_dir
|
||||
|
||||
set_tmp_config_dir()
|
||||
common.set_tmp_config_dir()
|
||||
dirname = os.path.dirname(__file__)
|
||||
deluge.ui.tracker_icons.PIL_INSTALLED = False
|
||||
common.disable_new_release_check()
|
||||
|
||||
|
||||
class TrackerIconsTestCase(BaseTestCase):
|
||||
|
2
tox.ini
2
tox.ini
@ -120,7 +120,7 @@ whitelist_externals =
|
||||
{[testenv]whitelist_externals}
|
||||
coverage
|
||||
commands =
|
||||
coverage run --branch --source=deluge -m py.test "not (todo or gtkui)" deluge/tests/
|
||||
coverage run --branch --source=deluge -m py.test -m "not todo" deluge/tests/
|
||||
|
||||
[testenv:testcoverage]
|
||||
deps = {[testcoveragebase]deps}
|
||||
|
Loading…
x
Reference in New Issue
Block a user