mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-03-16 22:20:25 +00:00
Use pytest as test runner
* Used pytest to run tests within tox environments * Removed test runner within setup.py
This commit is contained in:
parent
146a96fca0
commit
10d109eb6c
3 changed files with 6 additions and 34 deletions
|
|
@ -5,3 +5,6 @@ all_files = 1
|
|||
|
||||
[upload_sphinx]
|
||||
upload-dir = build/docs/html
|
||||
|
||||
[tool:pytest]
|
||||
DJANGO_SETTINGS_MODULE = analytical.tests.settings
|
||||
33
setup.py
33
setup.py
|
|
@ -17,42 +17,9 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class TestCommand(Command):
|
||||
description = "run package tests"
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
from analytical.tests.utils import run_tests
|
||||
|
||||
run_tests()
|
||||
|
||||
|
||||
cmdclass['test'] = TestCommand
|
||||
|
||||
|
||||
def read_file(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
|
||||
try:
|
||||
import django
|
||||
os.environ.setdefault(
|
||||
"DJANGO_SETTINGS_MODULE",
|
||||
"analytical.tests.settings"
|
||||
)
|
||||
django.setup()
|
||||
except ImportError:
|
||||
print(
|
||||
"Could not import django. "
|
||||
"This is fine, unless you intend to run unit tests."
|
||||
)
|
||||
|
||||
import analytical as package # noqa
|
||||
|
||||
setup(
|
||||
|
|
|
|||
4
tox.ini
4
tox.ini
|
|
@ -10,11 +10,13 @@ envlist =
|
|||
description = Unit tests
|
||||
deps =
|
||||
coverage
|
||||
pytest
|
||||
pytest-django
|
||||
django111: Django>=1.11,<2.0
|
||||
django22: Django>=2.2,<3.0
|
||||
django30: Django>=3.0,<3.1
|
||||
commands =
|
||||
coverage run setup.py test
|
||||
coverage run -m pytest
|
||||
coverage xml
|
||||
|
||||
[gh-actions]
|
||||
|
|
|
|||
Loading…
Reference in a new issue