From 56780d5eb11abee6681e79d794a3cd9de7f5e54c Mon Sep 17 00:00:00 2001 From: orsinium Date: Wed, 3 Jan 2018 17:56:02 +0500 Subject: [PATCH] more tox tests --- requirements-optional.txt => constraints.txt | 4 +- requirements.txt | 2 - requirements/constraints.txt | 9 ++ requirements/main.txt | 2 + .../testing-side.txt | 2 + run_tests.py | 29 ++++--- setup.py | 2 +- tests/{django_and_other.py => djside.py} | 0 tox.ini | 82 +++++++++++++++---- 9 files changed, 101 insertions(+), 31 deletions(-) rename requirements-optional.txt => constraints.txt (51%) delete mode 100644 requirements.txt create mode 100644 requirements/constraints.txt create mode 100644 requirements/main.txt rename requirements-testing.txt => requirements/testing-side.txt (89%) rename tests/{django_and_other.py => djside.py} (100%) diff --git a/requirements-optional.txt b/constraints.txt similarity index 51% rename from requirements-optional.txt rename to constraints.txt index 0170e2a..147a99c 100644 --- a/requirements-optional.txt +++ b/constraints.txt @@ -1,6 +1,8 @@ bson -djangorestframework +django>=1.7 +djangorestframework>=3.5 marshmallow pyschemes PyYAML tablib + diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 686e24f..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -django>=1.7 -six diff --git a/requirements/constraints.txt b/requirements/constraints.txt new file mode 100644 index 0000000..618921b --- /dev/null +++ b/requirements/constraints.txt @@ -0,0 +1,9 @@ +bson +django>=1.7 +djangorestframework>=3.5 +marshmallow +pyschemes +PyYAML +six +tablib + diff --git a/requirements/main.txt b/requirements/main.txt new file mode 100644 index 0000000..3c0f995 --- /dev/null +++ b/requirements/main.txt @@ -0,0 +1,2 @@ +six + diff --git a/requirements-testing.txt b/requirements/testing-side.txt similarity index 89% rename from requirements-testing.txt rename to requirements/testing-side.txt index 3b04186..c650714 100644 --- a/requirements-testing.txt +++ b/requirements/testing-side.txt @@ -2,4 +2,6 @@ bson marshmallow pyschemes PyYAML +six tablib + diff --git a/run_tests.py b/run_tests.py index 95a14cd..c26f8c8 100644 --- a/run_tests.py +++ b/run_tests.py @@ -2,7 +2,6 @@ import os import sys -import django import unittest # for python2 @@ -10,20 +9,30 @@ import unittest2 as unittest -sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/example') -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") -django.setup() +testing_type = sys.argv[1] if len(sys.argv) > 1 else '' + + +if not testing_type or testing_type in ('django', 'djside'): + import django + sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/example') + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") + django.setup() import djburger # noQA -from tests.django import * # noQA -from tests.django_and_other import * # noQA -from tests.main import * # noQA -from tests.marshmallow import * # noQA -from tests.pyschemes import * # noQA -from tests.rest import * # noQA +from tests import main +if not testing_type or testing_type == 'django': + from tests import django +if not testing_type or testing_type == 'djside': + from tests import djside +if not testing_type or testing_type == 'rest': + from tests import rest +if not testing_type or testing_type == 'marshmallow': + from tests import marshmallow +if not testing_type or testing_type == 'pyschemes': + from tests import pyschemes if __name__ == '__main__': diff --git a/setup.py b/setup.py index f5ab3f0..81495cb 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ keywords = 'djburger framework django contracts pre post validation', packages = ['djburger'], - requires = [], + requires = ['six'], url = 'https://github.com/orsinium/djburger', download_url = 'https://github.com/orsinium/djburger/tarball/master', diff --git a/tests/django_and_other.py b/tests/djside.py similarity index 100% rename from tests/django_and_other.py rename to tests/djside.py diff --git a/tox.ini b/tox.ini index f780402..ee171b2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,30 +1,78 @@ [tox] envlist = - py27-unittest2-django18-rest35, - py27-unittest2-django110-rest, - py27-unittest2-django111-rest, - py35-django18-rest35, - py35-django110-rest, - py35-django111-rest, - py35-django20-rest, - -[testenv] -commands = python run_tests.py + # main + py{2,3}-main, + # django + py2-django-django{18,110,111}, + py3-django-django{18,110,111,20,master}, + # djside + py2-djside-django{18,110,111}, + py3-djside-django{18,110,111,20,master}, + # side + py2-side-django{18,110,111}, + py3-side-django{18,110,111,20,master}, + # other + flake8, + + +[testenv:main] +commands = python run_tests.py main envdir = {toxworkdir}/venvs/{envname} setenv = PYTHONDONTWRITEBYTECODE=1 PYTHONWARNINGS=once deps = + py2: unittest2 + -rrequirements/main.txt + + +[testenv:django] +commands = python run_tests.py django +envdir = {toxworkdir}/venvs/{envname} +setenv = + PYTHONDONTWRITEBYTECODE=1 + PYTHONWARNINGS=once +deps = + # django django18: Django>=1.8,<1.9 django110: Django>=1.10,<1.11 - django111: Django>=1.11,<2.0 + django111: Django>=1.11,<1.12 django20: Django>=2.0,<2.1 djangomaster: https://github.com/django/django/archive/master.tar.gz - rest: djangorestframework - rest35: djangorestframework>=3.5,<3.6 - rest32: djangorestframework>=3.2,<3.3 - unittest2: unittest2 - -rrequirements-testing.txt + # testing + py2: unittest2 + -rrequirements/main.txt + + +[testenv:djside] +commands = python run_tests.py djside +envdir = {toxworkdir}/venvs/{envname} +setenv = + PYTHONDONTWRITEBYTECODE=1 + PYTHONWARNINGS=once +deps = + django{110,111,20,master}: djangorestframework + django18: djangorestframework>=3.5,<3.6 + py2: unittest2 + -rrequirements/testing-side.txt + -[flake8] +[testenv:side] +commands = python run_tests.py marshmallow pyschemes +envdir = {toxworkdir}/venvs/{envname} +setenv = + PYTHONDONTWRITEBYTECODE=1 + PYTHONWARNINGS=once +deps = + py2: unittest2 + -rrequirements/testing-side.txt + + +[testenv:flake8] max-line-length=120 +skip_install = True +deps = + flake8 +commands = + flake8 --exclude=migrations {toxinidir}/djburger +