diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..1747a1b --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +DJANGO_SETTINGS_MODULE = tests.settings +python_files = tests.py test_*.py *_tests.py diff --git a/requirements_test.txt b/requirements_test.txt index 0e2b47e..8c5c538 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -5,3 +5,6 @@ mock>=1.0.1 flake8>=2.1.0 tox>=1.7.0 coveralls +pytest +pytest-django +pytest-cov diff --git a/runtests.py b/runtests.py deleted file mode 100644 index 035a375..0000000 --- a/runtests.py +++ /dev/null @@ -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:]) diff --git a/tox.ini b/tox.ini index ae0f7f3..3225116 100644 --- a/tox.ini +++ b/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