Skip to content

Commit

Permalink
Add tox targets for Django 2.2 & master. Add coverage & flake8 valida…
Browse files Browse the repository at this point in the history
…tion. Fix templatetags test view.
  • Loading branch information
joehybird committed Apr 26, 2019
1 parent 59c87ef commit 3ac066a
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 59 deletions.
56 changes: 11 additions & 45 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,16 @@ python:
- "3.5"
- "3.6"
- "3.7"
env:
- DJANGO="django>=1.8,<1.9"
- DJANGO="django>=1.9,<1.10"
- DJANGO="django>=1.10,<1.11"
- DJANGO="django>=1.11,<2.0"
- DJANGO="django>=2.0,<2.1"
- DJANGO="django>=2.1,<2.2"
install:
- "pip install user-agents"
- "pip install ${DJANGO}"
script:
- "python manage.py test"
matrix:
exclude:
- python: "2.7"
env: DJANGO="django>=2.0,<2.1"
- python: "2.7"
env: DJANGO="django>=2.1,<2.2"
- python: "3.4"
env: DJANGO="django>=2.1,<2.2"
- python: "3.6"
env: DJANGO="django>=1.8,<1.9"
- python: "3.6"
env: DJANGO="django>=1.9,<1.10"
- python: "3.6"
env: DJANGO="django>=1.10,<1.11"
- python: "3.7"
env: DJANGO="django>=1.8,<1.9"
- python: "3.7"
env: DJANGO="django>=1.9,<1.10"
- python: "3.7"
env: DJANGO="django>=1.10,<1.11"
- python: "3.7"
env: DJANGO="django>=1.11,<2.0"
- pip install user-agents
- pip install tox tox-travis
jobs:
include:
- python: "pypy"
env: DJANGO="django>=1.8,<1.9"
dist: trusty
- python: "pypy"
env: DJANGO="django>=1.9,<1.10"
dist: trusty
- python: "pypy"
env: DJANGO="django>=1.10,<1.11"
dist: trusty
- python: "pypy"
env: DJANGO="django>=1.11,<2.0"
dist: trusty
- stage: lint
python: "3.6"
script: tox -e flake8
- stage: test
script: tox
- stage: coverage
python: "3.6"
script: tox -e coverage
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ Running Tests
Changelog
=========

unreleased
----------
* Add support for Django 2.0 to 2.2

0.3.1
-----
* Fixed a bug when request have no META attribute
Expand Down
2 changes: 1 addition & 1 deletion django_user_agents/templatetags/user_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ def is_bot(request):

@register.filter()
def is_touch_capable(request):
return get_and_set_user_agent(request).is_touch_capable
return get_and_set_user_agent(request).is_touch_capable
4 changes: 3 additions & 1 deletion django_user_agents/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .tests import MiddlewareTest
from .tests import MiddlewareTest

__all__ = ['MiddlewareTest']
3 changes: 3 additions & 0 deletions django_user_agents/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def test_filters_can_be_loaded_in_template(self):
client = Client(HTTP_USER_AGENT=ipad_ua_string)
response = client.get(reverse('user_agent_test_filters'))
self.assertEqual(response.status_code, 200)
self.assertContains(
response,
'Just making sure all the filters can be used without errors')

def test_filters(self):
request = RequestFactory(HTTP_USER_AGENT=iphone_ua_string).get('')
Expand Down
2 changes: 1 addition & 1 deletion django_user_agents/tests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ def test(request):


def test_filters(request):
return render(request, "test.html", {'request': request})
return render(request, "test_filters.html", {'request': request})
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP',
Expand Down
56 changes: 47 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,62 @@
[tox]
envlist = py{27,34,35,36}-django{18,19,110,111},
envlist = flake8,
py{27,34,35,36}-django{18,19,110,111},
py{34}-django{20},
py{35,36,37}-django{20,21}
py{35,36,37}-django{20,21,22}
py{36,37}-djangomaster,
coverage

install_command = pip install {opts} {packages}

[testenv]
basepython =
py27: python2.7
py34: python3.4
py35: python3.5
py36: python3.6
py37: python3.7
deps =
-e.
flake8: flake8
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<3.0
djangomaster: https://github.com/django/django/archive/master.tar.gz
commands =
python -Wd manage.py test
python -Wd manage.py test {posargs}

[tox:travis]
2.7 = py27
3.4 = py34
3.5 = py35
3.6 = py36
3.7 = py37

[travis:env]
DJANGO =
1.8: django18
1.9: django19
1.10: django110
1.11: django111
2.0: django20
2.1: django21
2.2: django22
master: djangomaster

[testenv:coverage]
basepython = python3.6
deps =
coverage
Django>=2.2,<3.0
commands =
python -Wd {envbindir}/coverage run --source=django_user_agents --omit=*/tests/* manage.py test {posargs}
coverage report -m

[testenv:py36-djangomaster]
ignore_outcome=true

[testenv:py37-djangomaster]
ignore_outcome=true

[testenv:flake8]
deps =
flake8
commands = flake8 django_user_agents --ignore=E501

0 comments on commit 3ac066a

Please sign in to comment.