Replace CoverageTestRunner with nosetests
This commit is contained in:
parent
d48d8d4d86
commit
fdf3d4f11b
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,8 +4,10 @@
|
|||||||
.idea
|
.idea
|
||||||
MANIFEST
|
MANIFEST
|
||||||
build/
|
build/
|
||||||
|
cover/
|
||||||
dist/
|
dist/
|
||||||
docs/_build/
|
docs/_build/
|
||||||
|
nosetests.xml
|
||||||
pip-log.txt
|
pip-log.txt
|
||||||
src/
|
src/
|
||||||
tmp/
|
tmp/
|
||||||
|
|||||||
@ -44,20 +44,22 @@ style guidelines, with a couple of notable exceptions:
|
|||||||
Running tests
|
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::
|
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
|
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
|
python tests
|
||||||
|
|
||||||
|
For more documentation on testing Mopidy, check out the `nose docs
|
||||||
|
<http://somethingaboutorange.com/mrl/projects/nose/>`_.
|
||||||
|
|
||||||
|
|
||||||
Writing documentation
|
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
|
site for lots of documentation on how to use Sphinx. To generate HTML or LaTeX
|
||||||
from the documentation files, you need some additional dependencies.
|
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
|
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::
|
Then, to generate docs::
|
||||||
|
|
||||||
cd docs/
|
cd docs/
|
||||||
|
|||||||
@ -32,9 +32,10 @@ class DespotifyBackend(BaseBackend):
|
|||||||
- r503: Segfaults when looking up playlists, both your own lists and other
|
- r503: Segfaults when looking up playlists, both your own lists and other
|
||||||
peoples shared lists. To reproduce::
|
peoples shared lists. To reproduce::
|
||||||
|
|
||||||
>>> import spytify
|
>>> import spytify # doctest: +SKIP
|
||||||
>>> s = spytify.Spytify('alice', 'secret')
|
>>> s = spytify.Spytify('alice', 'secret') # doctest: +SKIP
|
||||||
>>> s.lookup('spotify:user:klette:playlist:5rOGYPwwKqbAcVX8bW4k5V')
|
>>> s.lookup('spotify:user:klette:playlist:5rOGYPwwKqbAcVX8bW4k5V')
|
||||||
|
... # doctest: +SKIP
|
||||||
Segmentation fault
|
Segmentation fault
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
coverage
|
coverage
|
||||||
-e bzr+http://liw.iki.fi/bzr/coverage-test-runner/trunk/#egg=CoverageTestRunner
|
nose
|
||||||
|
|||||||
8
setup.cfg
Normal file
8
setup.cfg
Normal 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
|
||||||
@ -1,19 +1,4 @@
|
|||||||
import logging
|
import nose
|
||||||
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()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
nose.main()
|
||||||
|
|||||||
@ -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)
|
|
||||||
46
tests/backends/base_test.py
Normal file
46
tests/backends/base_test.py
Normal 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
0
tests/mixers/__init__.py
Normal file
0
tests/mpd/__init__.py
Normal file
0
tests/mpd/__init__.py
Normal file
Loading…
Reference in New Issue
Block a user