From a384dc559f345ae0c74fb80c060efef532d9e1fa Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Thu, 21 Jun 2018 22:23:26 +0900 Subject: [PATCH] Fix and reorganize tox env definitions * Define py35 commands in a single place. Previously it was defined in [testenv] and [testenv:py35]. * py35 env should use python3.5 instead of python3 because pyNN job is specific to a specific python version. In addition, python version is automatically assumed by tox. * Sort env definitions in the order of unit tests, other testing stuffs with 'testenv:' prefix and finally non testenv stuffs (like flake8). * Drop testenv:manage-py35dj20 because testenv:manage now uses python 3.5 and Django 2.0. * Avoid using dict-style env commands definitions. In OpenStack projects, we usually use [testenv:xxxx] style. Change-Id: Ib55031a50a51f952b738f0fdf33313fa2c7522ff --- tox.ini | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/tox.ini b/tox.ini index 3bc1a4e220..ef9d2cce2d 100644 --- a/tox.ini +++ b/tox.ini @@ -15,20 +15,17 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt +commands = {[unit_tests]commands} + +[unit_tests] commands = - horizon: {envpython} {toxinidir}/manage.py test --settings=horizon.test.settings {posargs} - py27: {[unit_tests]commands} - py35: {[unit_tests]commands} - openstack_dashboard: {envpython} {toxinidir}/manage.py test --settings=openstack_dashboard.test.settings {posargs} - runserver: {envpython} {toxinidir}/manage.py runserver {posargs} - venv: {posargs} + find . -type f -name "*.pyc" -delete + bash {toxinidir}/tools/unit_tests.sh {envpython} {toxinidir} {posargs} [testenv:py35] -basepython = python3 setenv = PYTHONUNBUFFERED = 1 {[testenv]setenv} -commands = {[unit_tests]commands} [testenv:py3-dj111] basepython = python3 @@ -36,10 +33,16 @@ commands = pip install django>=1.11,<2 {[unit_tests]commands} -[unit_tests] -commands = - find . -type f -name "*.pyc" -delete - bash {toxinidir}/tools/unit_tests.sh {envpython} {toxinidir} {posargs} +[testenv:lower-constraints] +basepython = python3 +deps = + -c{toxinidir}/lower-constraints.txt + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt + +[testenv:venv] +basepython = python3 +commands = {posargs} [testenv:pep8] basepython = python3 @@ -52,6 +55,7 @@ commands = {envpython} {toxinidir}/manage.py extract_messages --verbosity 0 --check-only bash {toxinidir}/tools/find_executables.sh doc8 doc/source releasenotes/source releasenotes/notes + python setup.py check --restructuredtext --strict [testenv:cover] basepython = python3 @@ -149,12 +153,9 @@ basepython = python3 deps = commands = {envpython} {toxinidir}/manage.py {posargs} -[testenv:manage-py35dj20] -basepython = python3.5 -deps = {[testenv:manage]deps} -commands = - pip install django>=2.0,<2.1 - {[testenv:manage]commands} +[testenv:runserver] +basepython = python3 +commands = {envpython} {toxinidir}/manage.py runserver {posargs} [flake8] filename = *.py,django.wsgi @@ -186,12 +187,3 @@ max-line-length = 80 # D000: Check RST validity # - cannot handle "none" for code-block directive ignore = D000 - -[testenv:lower-constraints] -basepython = python3 -deps = - -c{toxinidir}/lower-constraints.txt - -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt -commands = - {[unit_tests]commands}