diff --git a/.travis.yml b/.travis.yml index f40e652..376584d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,18 @@ sudo: false -language: python -python: 2.7 - cache: pip +language: python +python: 3.6 env: + - TOX_ENV=pypy-django11 + - TOX_ENV=py27-django11 + - TOX_ENV=py35-django11 + - TOX_ENV=py35-django20 + - TOX_ENV=py36-django11 + - TOX_ENV=py36-django20 + - TOX_ENV=flake8 + - TOX_ENV=docs - TOX_ENV=coveralls - - TOX_ENV=py27-django18 - - TOX_ENV=py27-django19 - - TOX_ENV=py27-django110 - - TOX_ENV=py34-django18 - - TOX_ENV=py34-django19 - - TOX_ENV=py34-django110 - - TOX_ENV=py35-django18 - - TOX_ENV=py35-django19 - - TOX_ENV=py35-django110 - - TOX_ENV=py36-django18 - - TOX_ENV=py36-django19 - - TOX_ENV=py36-django110 - - TOX_ENV=pypy-django18 - - TOX_ENV=pypy-django19 - - TOX_ENV=pypy-django110 install: - pip install --upgrade pip diff --git a/django_admin_generator/__about__.py b/django_admin_generator/__about__.py index 37a0e72..b5dd509 100644 --- a/django_admin_generator/__about__.py +++ b/django_admin_generator/__about__.py @@ -2,7 +2,9 @@ __version__ = '2.0.0' __author__ = 'Rick van Hattem' __author_email__ = 'Wolph@Wol.ph' -__description__ = ('Django Admin Generator is a management command to ' -'automatically generate a Django `admin.py` file for given apps/models.') +__description__ = ' '.join((''' +Django Admin Generator is a management command to automatically generate a +Django `admin.py` file for given apps/models. +'''.strip().split())) __url__ = 'https://github.com/WoLpH/django-admin-generator/' diff --git a/docs/requirements.txt b/docs/requirements.txt index f2a9ca3..62d6cd8 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1 @@ -sphinx -django +-e.[docs,tests] diff --git a/setup.cfg b/setup.cfg index 37672a0..61b41b9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,6 @@ +[metadata] +description-file = README.rst -[wheel] +[bdist_wheel] universal = 1 + diff --git a/setup.py b/setup.py index 9bb724c..7ff33a3 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ import os +import sys import setuptools +from setuptools.command.test import test as TestCommand # To prevent importing about and thereby breaking the coverage info we use this # exec hack @@ -11,8 +13,21 @@ if os.path.isfile('README.rst'): long_description = open('README.rst').read() else: - long_description = 'See http://pypi.python.org/pypi/%s/' % ( - about['__package_name__']) + long_description = ('See http://pypi.python.org/pypi/' + + about['__package_name__']) + + +class PyTest(TestCommand): + 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.test_args) + sys.exit(errno) if __name__ == '__main__': @@ -25,13 +40,27 @@ url=about['__url__'], license='BSD', packages=setuptools.find_packages(), - long_description=long_description, install_requires=[ - 'django-utils2>=2.2.1', + 'django-utils2>=2.5.0', 'six', ], - tests_require=['pytest'], - setup_requires=['pytest-runner'], + extras_require={ + 'docs': [ + 'django>=1.11', + 'mock', + 'sphinx>=1.6.0', + ], + 'tests': [ + 'pytest', + 'pytest-cache', + 'pytest-cov', + 'pytest-django', + 'pytest-flakes', + 'pytest-pep8', + ], + }, + long_description=long_description, + cmdclass={'test': PyTest}, classifiers=['License :: OSI Approved :: BSD License'], ) diff --git a/test_project/requirements.txt b/test_project/requirements.txt index 38eb0fa..9628e3f 100644 --- a/test_project/requirements.txt +++ b/test_project/requirements.txt @@ -1,8 +1 @@ -six -pytest -pytest-cache -pytest-cov -pytest-django -pytest-flakes -pytest-pep8 -python-utils +-e.[tests] diff --git a/tox.ini b/tox.ini index ad11be6..e5fb7ee 100644 --- a/tox.ini +++ b/tox.ini @@ -1,31 +1,45 @@ [tox] envlist = - py27-django{18,19,110}, - py34-django{18,19,110}, - py35-django{18,19,110}, - py36-django{18,19,110}, - pypy-django{18,19,110}, + py{py,27}-django11, + py35-django{11,20}, + py36-django{11,20}, + flake8, + docs skip_missing_interpreters = True usedevelop = True [testenv] -deps = - django14: Django>=1.4,<1.5 - django15: Django>=1.5,<1.6 - django16: Django>=1.6,<1.7 - django17: Django>=1.7,<1.8 - django18: Django>=1.8,<1.9 - django19: Django>=1.9,<1.10 - django110: Django>=1.10,<1.11 +deps = + django11: Django<2.0 + django20: Django>=2.0,<2.1 -rtest_project/requirements.txt -commands = - pip freeze - py.test +envlist = + py{py,27}-django11, + py35-django{11,20}, + py36-django{11,20}, -setenv = - PYTHONPATH = {toxinidir}:{env:PYTHONPATH:} +commands = + python setup.py test + +[testenv:flake8] +deps = flake8 +commands = flake8 --ignore=W391 django_admin_generator {posargs} + +[testenv:docs] +whitelist_externals = + rm + cd + mkdir +commands = + rm -f docs/project_name.rst + rm -f docs/modules.rst + mkdir -p docs/_static + sphinx-apidoc -o docs/ django_admin_generator + rm -f docs/modules.rst + sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html {posargs} +deps = -r{toxinidir}/docs/requirements.txt [testenv:coveralls] passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH @@ -36,6 +50,6 @@ commands = coveralls deps = - Django>=1.10,<1.11 + Django>=2.0,<2.1 -rtest_project/requirements.txt coveralls