Merge pull request #1024 from jodal/feature/pytest
Use py.test as test runner
This commit is contained in:
commit
a760833ab2
@ -12,12 +12,11 @@ flake8-import-order
|
||||
mock
|
||||
|
||||
# Test runners
|
||||
nose
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-xdist
|
||||
tox
|
||||
|
||||
# Measure test's code coverage
|
||||
coverage
|
||||
|
||||
# Check that MANIFEST.in matches Git repo contents before making a release
|
||||
check-manifest
|
||||
|
||||
|
||||
@ -89,11 +89,11 @@ Mopidy to come with tests.
|
||||
|
||||
#. To run all tests, go to the project directory and run::
|
||||
|
||||
nosetests
|
||||
py.test
|
||||
|
||||
To run tests with test coverage statistics::
|
||||
|
||||
nosetests --with-coverage
|
||||
py.test --cov=mopidy --cov-report=term-missing
|
||||
|
||||
Test coverage statistics can also be viewed online at
|
||||
`coveralls.io <https://coveralls.io/r/mopidy/mopidy>`_.
|
||||
|
||||
@ -189,11 +189,6 @@ class that will connect the rest of the dots.
|
||||
'Pykka >= 1.1',
|
||||
'pysoundspot',
|
||||
],
|
||||
test_suite='nose.collector',
|
||||
tests_require=[
|
||||
'nose',
|
||||
'mock >= 1.0',
|
||||
],
|
||||
entry_points={
|
||||
'mopidy.ext': [
|
||||
'soundspot = mopidy_soundspot:Extension',
|
||||
|
||||
@ -1,34 +1,15 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import inspect
|
||||
import warnings
|
||||
|
||||
|
||||
def _is_pykka_proxy_creation():
|
||||
stack = inspect.stack()
|
||||
try:
|
||||
calling_frame = stack[3]
|
||||
except IndexError:
|
||||
return False
|
||||
else:
|
||||
filename = calling_frame[1]
|
||||
funcname = calling_frame[3]
|
||||
return 'pykka' in filename and funcname == '_get_attributes'
|
||||
|
||||
|
||||
def deprecated_property(
|
||||
getter=None, setter=None, message='Property is deprecated'):
|
||||
|
||||
def deprecated_getter(*args):
|
||||
if not _is_pykka_proxy_creation():
|
||||
warnings.warn(message, DeprecationWarning, stacklevel=2)
|
||||
return getter(*args)
|
||||
# During development, this is a convenient place to add logging, emit
|
||||
# warnings, or ``assert False`` to ensure you are not using any of the
|
||||
# deprecated properties.
|
||||
#
|
||||
# Using inspect to find the call sites to emit proper warnings makes
|
||||
# parallel execution of our test suite slower than serial execution. Thus,
|
||||
# we don't want to add any extra overhead here by default.
|
||||
|
||||
def deprecated_setter(*args):
|
||||
if not _is_pykka_proxy_creation():
|
||||
warnings.warn(message, DeprecationWarning, stacklevel=2)
|
||||
return setter(*args)
|
||||
|
||||
new_getter = getter and deprecated_getter
|
||||
new_setter = setter and deprecated_setter
|
||||
return property(new_getter, new_setter)
|
||||
return property(getter, setter)
|
||||
|
||||
5
setup.py
5
setup.py
@ -29,11 +29,6 @@ setup(
|
||||
'tornado >= 2.3',
|
||||
],
|
||||
extras_require={'http': []},
|
||||
test_suite='nose.collector',
|
||||
tests_require=[
|
||||
'nose',
|
||||
'mock >= 1.0',
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'mopidy = mopidy.__main__:main',
|
||||
|
||||
6
tasks.py
6
tasks.py
@ -15,11 +15,9 @@ def test(path=None, coverage=False, watch=False, warn=False):
|
||||
if watch:
|
||||
return watcher(test, path=path, coverage=coverage)
|
||||
path = path or 'tests/'
|
||||
cmd = 'nosetests'
|
||||
cmd = 'py.test'
|
||||
if coverage:
|
||||
cmd += (
|
||||
' --with-coverage --cover-package=mopidy'
|
||||
' --cover-branches --cover-html')
|
||||
cmd += ' --cov=mopidy --cov-report=term-missing'
|
||||
cmd += ' %s' % path
|
||||
run(cmd, pty=True, warn=warn)
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import nose
|
||||
|
||||
nose.main()
|
||||
16
tox.ini
16
tox.ini
@ -3,20 +3,26 @@ envlist = py27, py27-tornado23, py27-tornado31, docs, flake8
|
||||
|
||||
[testenv]
|
||||
sitepackages = true
|
||||
commands = nosetests -v --with-xunit --xunit-file=xunit-{envname}.xml --with-coverage --cover-package=mopidy
|
||||
commands =
|
||||
py.test \
|
||||
--basetemp={envtmpdir} \
|
||||
--junit-xml=xunit-{envname}.xml --cov=mopidy \
|
||||
-n 4 \
|
||||
{posargs}
|
||||
deps =
|
||||
coverage
|
||||
mock
|
||||
nose
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-xdist
|
||||
|
||||
[testenv:py27-tornado23]
|
||||
commands = nosetests -v tests/http
|
||||
commands = py.test tests/http
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
tornado==2.3
|
||||
|
||||
[testenv:py27-tornado31]
|
||||
commands = nosetests -v tests/http
|
||||
commands = py.test tests/http
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
tornado==3.1.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user