Skip to content

Commit

Permalink
updated to support django 1.11 and django 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Apr 5, 2018
1 parent 4aae2e5 commit 4150110
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 56 deletions.
28 changes: 10 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions django_admin_generator/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
__version__ = '2.0.0'
__author__ = 'Rick van Hattem'
__author_email__ = '[email protected]'
__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/'

3 changes: 1 addition & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
sphinx
django
-e.[docs,tests]
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[metadata]
description-file = README.rst

[wheel]
[bdist_wheel]
universal = 1

41 changes: 35 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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__':
Expand All @@ -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'],
)

9 changes: 1 addition & 8 deletions test_project/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
six
pytest
pytest-cache
pytest-cov
pytest-django
pytest-flakes
pytest-pep8
python-utils
-e.[tests]
52 changes: 33 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -36,6 +50,6 @@ commands =
coveralls

deps =
Django>=1.10,<1.11
Django>=2.0,<2.1
-rtest_project/requirements.txt
coveralls

0 comments on commit 4150110

Please sign in to comment.