mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
Update test runner script and versions
- Use manage.py for running tests instead of a custom script - Drop support for Python 3.5 for Django master for tox and Travis - Run branch coverage tests in addition to line coverage Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
This commit is contained in:
parent
9c328713e7
commit
d293976e1c
5 changed files with 6 additions and 58 deletions
|
|
@ -1,2 +1,3 @@
|
|||
[run]
|
||||
source=axes
|
||||
branch = True
|
||||
source = axes
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ matrix:
|
|||
env: DJANGO=2.1
|
||||
- python: 3.4
|
||||
env: DJANGO=master
|
||||
- python: 3.5
|
||||
env: DJANGO=master
|
||||
install: pip install tox-travis codecov
|
||||
script: tox
|
||||
after_success:
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from .test_settings import * # pylint: disable=unused-wildcard-import
|
||||
|
||||
AXES_CACHE = 'axes'
|
||||
|
||||
CACHES = {
|
||||
'axes': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
||||
}
|
||||
}
|
||||
43
runtests.py
43
runtests.py
|
|
@ -1,43 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test.utils import get_runner
|
||||
|
||||
|
||||
def run_tests():
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'axes.test_settings'
|
||||
django.setup()
|
||||
TestRunner = get_runner(settings)
|
||||
test_runner = TestRunner()
|
||||
failures = test_runner.run_tests(['axes.tests'])
|
||||
sys.exit(bool(failures))
|
||||
|
||||
|
||||
def run_tests_cache():
|
||||
"""Check that using a wrong cache backend (LocMemCache) throws correctly
|
||||
|
||||
This is due to LocMemCache not working with AccessAttempt caching,
|
||||
please see issue https://github.com/jazzband/django-axes/issues/288
|
||||
"""
|
||||
|
||||
try:
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'axes.test_settings_cache'
|
||||
django.setup()
|
||||
print('Using LocMemCache as a cache backend does not throw')
|
||||
sys.exit(1)
|
||||
except ImproperlyConfigured:
|
||||
print('Using LocMemCache as a cache backend throws correctly')
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if 'cache' in sys.argv:
|
||||
run_tests_cache()
|
||||
run_tests()
|
||||
5
tox.ini
5
tox.ini
|
|
@ -3,7 +3,7 @@ envlist =
|
|||
py{27,34,35,36,37}-django111
|
||||
py{34,35,36,37}-django20
|
||||
py{35,36,37}-django21
|
||||
py{35,36,37}-djangomaster
|
||||
py{36,37}-djangomaster
|
||||
|
||||
[travis]
|
||||
python =
|
||||
|
|
@ -31,8 +31,7 @@ usedevelop = True
|
|||
ignore_outcome =
|
||||
djangomaster: True
|
||||
commands =
|
||||
coverage run -a runtests.py -v2
|
||||
coverage run -a runtests.py -v2 cache
|
||||
coverage run -a manage.py test -v2
|
||||
coverage report
|
||||
prospector
|
||||
setenv =
|
||||
|
|
|
|||
Loading…
Reference in a new issue