proper setup.py setup & test

This commit is contained in:
boyska 2014-10-29 00:39:43 +01:00
parent 2bc118bfd9
commit b1f597deae
10 changed files with 54 additions and 3 deletions

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
*.pyc
.*.sw?
/dist/
/*.egg-info
build

0
larigira/__init__.py Normal file
View file

View file

@ -80,7 +80,7 @@ def on_player_crash(*args, **kwargs):
sys.exit(1)
if __name__ == '__main__':
def main():
p = Player()
p.start()
p.link_exception(on_player_crash)
@ -90,3 +90,6 @@ if __name__ == '__main__':
p.q.put('signal', *args)
gevent.signal(signal.SIGHUP, sig, signal.SIGHUP)
gevent.wait()
if __name__ == '__main__':
main()

View file

@ -6,7 +6,7 @@ import pytest
import gevent
from mpc import Timer, ParentedLet
from larigira.mpc import Timer, ParentedLet
# TODO: implement simple children and check that we will receive the expected
# messages on the queue

View file

@ -4,7 +4,7 @@ monkey.patch_all(subprocess=True)
import pytest
from rpc import create_app
from larigira.rpc import create_app
@pytest.fixture

45
setup.py Normal file
View file

@ -0,0 +1,45 @@
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
setup(name='larigira',
version='0.1',
description='A radio automation based on MPD',
author='boyska',
author_email='piuttosto@logorroici.org',
license='AGPL',
packages=['larigira'],
install_requires=[
'gevent',
'flask',
'python-mpd2',
'redis',
'celery'
],
tests_require=['pytest'],
cmdclass={'test': PyTest},
zip_safe=False,
entry_points={
'console_scripts': ['larigira=larigira.mpc:main']
}
)