use pytest for testing
This commit is contained in:
parent
6da3033fdf
commit
34928676c6
|
@ -0,0 +1,3 @@
|
|||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE = tests.settings
|
||||
python_files = tests.py test_*.py *_tests.py
|
|
@ -5,3 +5,6 @@ mock>=1.0.1
|
|||
flake8>=2.1.0
|
||||
tox>=1.7.0
|
||||
coveralls
|
||||
pytest
|
||||
pytest-django
|
||||
pytest-cov
|
||||
|
|
26
runtests.py
26
runtests.py
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.test.utils import get_runner
|
||||
|
||||
|
||||
def run_tests(*test_args):
|
||||
if not test_args:
|
||||
test_args = ["tests"]
|
||||
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
|
||||
django.setup()
|
||||
TestRunner = get_runner(settings)
|
||||
test_runner = TestRunner()
|
||||
failures = test_runner.run_tests(test_args)
|
||||
sys.exit(bool(failures))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_tests(*sys.argv[1:])
|
3
tox.ini
3
tox.ini
|
@ -5,9 +5,8 @@ envlist =
|
|||
[testenv]
|
||||
setenv =
|
||||
PYTHONPATH = {toxinidir}:{toxinidir}/django_cryptolock
|
||||
commands = coverage run --source django_cryptolock runtests.py
|
||||
commands = pytest --cov=django_cryptolock tests/
|
||||
deps =
|
||||
django-22: Django>=2.2
|
||||
-r {toxinidir}/requirements_test.txt
|
||||
basepython =
|
||||
py37: python3.7
|
||||
|
|
Loading…
Reference in New Issue