Replace CoverageTestRunner with nosetests

This commit is contained in:
Stein Magnus Jodal 2010-03-23 23:54:49 +01:00
parent d48d8d4d86
commit fdf3d4f11b
14 changed files with 70 additions and 77 deletions

2
.gitignore vendored
View File

@ -4,8 +4,10 @@
.idea
MANIFEST
build/
cover/
dist/
docs/_build/
nosetests.xml
pip-log.txt
src/
tmp/

View File

@ -44,20 +44,22 @@ style guidelines, with a couple of notable exceptions:
Running tests
=============
To run tests, you need a couple of dependencies. Some can be installed through
To run tests, you need a couple of dependencies. They can be installed through
Debian/Ubuntu package management::
sudo aptitude install python-coverage
sudo aptitude install python-coverage python-nose
The rest (or all dependencies if you want to) can be installed using pip::
Or, they can be installed using ``pip``::
sudo aptitude install python-pip python-setuptools bzr
sudo pip install -r requirements-tests.txt
Then, to run all tests::
Then, to run all tests, go to the project directory and run::
python tests
For more documentation on testing Mopidy, check out the `nose docs
<http://somethingaboutorange.com/mrl/projects/nose/>`_.
Writing documentation
=====================
@ -66,15 +68,10 @@ To write documentation, we use `Sphinx <http://sphinx.pocoo.org/>`_. See their
site for lots of documentation on how to use Sphinx. To generate HTML or LaTeX
from the documentation files, you need some additional dependencies.
You can either install them through Debian/Ubuntu package management::
You can install them through Debian/Ubuntu package management::
sudo aptitude install python-sphinx python-pygraphviz graphviz
Or, install them using pip::
sudo aptitude install python-pip python-setuptools graphviz
sudo pip install -r requirements-docs.txt
Then, to generate docs::
cd docs/

View File

@ -32,9 +32,10 @@ class DespotifyBackend(BaseBackend):
- r503: Segfaults when looking up playlists, both your own lists and other
peoples shared lists. To reproduce::
>>> import spytify
>>> s = spytify.Spytify('alice', 'secret')
>>> import spytify # doctest: +SKIP
>>> s = spytify.Spytify('alice', 'secret') # doctest: +SKIP
>>> s.lookup('spotify:user:klette:playlist:5rOGYPwwKqbAcVX8bW4k5V')
... # doctest: +SKIP
Segmentation fault
"""

View File

@ -1,2 +1,2 @@
coverage
-e bzr+http://liw.iki.fi/bzr/coverage-test-runner/trunk/#egg=CoverageTestRunner
nose

8
setup.cfg Normal file
View File

@ -0,0 +1,8 @@
[nosetests]
verbosity = 1
with-doctest = 1
with-coverage = 1
cover-package = mopidy
cover-inclusive = 1
cover-html = 1
with-xunit = 1

View File

@ -1,19 +1,4 @@
import logging
import os
import sys
from CoverageTestRunner import CoverageTestRunner
def main():
logging.basicConfig(level=logging.CRITICAL)
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
r = CoverageTestRunner()
r.add_pair('mopidy/mixers/dummy.py', 'tests/mixers/dummytest.py')
r.add_pair('mopidy/mixers/denon.py', 'tests/mixers/denontest.py')
r.add_pair('mopidy/models.py', 'tests/modelstest.py')
r.add_pair('mopidy/mpd/frontend.py', 'tests/mpd/frontendtest.py')
r.run()
import nose
if __name__ == '__main__':
main()
nose.main()

View File

@ -1,46 +0,0 @@
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_add(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri)
self.assertEqual(uri, playlist.tracks[-1].uri)
def test_add_at_position(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri, 0)
self.assertEqual(uri, playlist.tracks[0].uri)
# FIXME test other placements
class BasePlaybackControllerTest(object):
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_play(self):
playback = self.backend.playback
self.assertEqual(playback.state, playback.STOPPED)
playback.play()
self.assertEqual(playback.state, playback.PLAYING)
def test_next(self):
playback = self.backend.playback
current_song = playback.playlist_position
playback.next()
self.assertEqual(playback.playlist_position, current_song+1)

View File

@ -0,0 +1,46 @@
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_add(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri)
self.assertEqual(uri, playlist.tracks[-1].uri)
def test_add_at_position(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri, 0)
self.assertEqual(uri, playlist.tracks[0].uri)
# FIXME test other placements
class BasePlaybackControllerTest(object):
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_play(self):
playback = self.backend.playback
self.assertEqual(playback.state, playback.STOPPED)
playback.play()
self.assertEqual(playback.state, playback.PLAYING)
def test_next(self):
playback = self.backend.playback
current_song = playback.playlist_position
playback.next()
self.assertEqual(playback.playlist_position, current_song+1)

0
tests/mixers/__init__.py Normal file
View File

0
tests/mpd/__init__.py Normal file
View File