From 41d002a352cb243d413aea3e68828e4c95e7bdf4 Mon Sep 17 00:00:00 2001 From: Shyam Singh Date: Thu, 18 Jun 2020 21:02:45 +0530 Subject: [PATCH] Upgrade for stable/stein branch * Updated 'test-requirements.txt', 'tox.ini' with relevant 'stable/stein' branch libraries. * Added zuul jobs w.r.t. 'stable/stein' release. * Updated pbr in 'setup.py'. * Added 'flake8-import-order' & 'stestr' library. * Removed 'testr' dependency from tox test envrironment. * Used 'coverage' library for coverage. * Added python3 as basepython. Change-Id: I4f9da2fb661cfe2abb9002fcb47e1637a5a69a51 --- .stestr.conf | 3 ++ .zuul.yaml | 12 ++--- doc/source/index.rst | 2 +- gbpautomation/heat/tests/test_grouppolicy.py | 1 + gbpautomation/heat/tests/test_servicechain.py | 1 + setup.cfg | 3 ++ setup.py | 2 +- test-requirements.txt | 11 ++-- tox.ini | 50 +++++++++++++++---- 9 files changed, 59 insertions(+), 26 deletions(-) create mode 100644 .stestr.conf diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..b1a03be --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./gbpautomation/heat/tests} +top_dir=./ diff --git a/.zuul.yaml b/.zuul.yaml index 376bdd3..1a0d19a 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -14,26 +14,26 @@ - openstack-tox-pep8: required-projects: - name: openstack/requirements - override-checkout: stable/rocky + override-checkout: stable/stein - openstack-tox-py27: required-projects: - name: openstack/requirements - override-checkout: stable/rocky + override-checkout: stable/stein - openstack-tox-py35: required-projects: - name: openstack/requirements - override-checkout: stable/rocky + override-checkout: stable/stein gate: jobs: - openstack-tox-pep8: required-projects: - name: openstack/requirements - override-checkout: stable/rocky + override-checkout: stable/stein - openstack-tox-py27: required-projects: - name: openstack/requirements - override-checkout: stable/rocky + override-checkout: stable/stein - openstack-tox-py35: required-projects: - name: openstack/requirements - override-checkout: stable/rocky + override-checkout: stable/stein diff --git a/doc/source/index.rst b/doc/source/index.rst index 0126656..27d552d 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,7 +4,7 @@ contain the root `toctree` directive. Welcome to group-based-policy-automation's documentation! -======================================================== +========================================================= Contents: diff --git a/gbpautomation/heat/tests/test_grouppolicy.py b/gbpautomation/heat/tests/test_grouppolicy.py index d3a0591..e8bf062 100644 --- a/gbpautomation/heat/tests/test_grouppolicy.py +++ b/gbpautomation/heat/tests/test_grouppolicy.py @@ -11,6 +11,7 @@ # under the License. import copy + import mock import six diff --git a/gbpautomation/heat/tests/test_servicechain.py b/gbpautomation/heat/tests/test_servicechain.py index b28c037..83b3a31 100644 --- a/gbpautomation/heat/tests/test_servicechain.py +++ b/gbpautomation/heat/tests/test_servicechain.py @@ -11,6 +11,7 @@ # under the License. import copy + import mock import six diff --git a/setup.cfg b/setup.cfg index 09f6f38..3b0bdd8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,3 +48,6 @@ output_file = gbpautomation/locale/group-based-policy-automation.pot [entry_points] heat.clients = grouppolicy = gbpautomation.heat.engine.clients.os.grouppolicy:GBPClientPlugin + +[flake8] +import-order-style = pep8 diff --git a/setup.py b/setup.py index 782bb21..566d844 100755 --- a/setup.py +++ b/setup.py @@ -25,5 +25,5 @@ except ImportError: pass setuptools.setup( - setup_requires=['pbr>=1.8'], + setup_requires=['pbr>=2.0.0'], pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index c81ed18..4771ee3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,26 +2,21 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. --e git+https://opendev.org/openstack/heat.git@stable/rocky#egg=heat +-e git+https://opendev.org/openstack/heat.git@stable/stein#egg=heat -e git+https://opendev.org/x/python-group-based-policy-client.git@master#egg=gbpclient # Hacking already pins down pep8, pyflakes and flake8 hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 bandit<1.6.0,>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 -fixtures>=3.0.0 # Apache-2.0/BSD +flake8-import-order==0.12 # LGPLv3 kombu!=4.0.2,>=4.0.0 # BSD -mock>=2.0 # BSD PyMySQL>=0.7.6 # MIT License -openstackdocstheme>=1.18.1 # Apache-2.0 -os-api-ref>=1.4.0 # Apache-2.0 os-testr>=1.0.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 qpid-python>=0.26;python_version=='2.7' # Apache-2.0 psycopg2>=2.6.2 # LGPL/ZPL -sphinx!=1.6.6,>=1.6.2;python_version>='3.4' # BSD -sphinx!=1.6.6,>=1.6.2,<2.0.0;python_version=='2.7' # BSD +stestr>=2.0.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT testresources>=2.0.0 # Apache-2.0/BSD -reno>=2.5.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 3ed651f..e09dccb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,46 +1,64 @@ [tox] -envlist = py27,py35, pep8 -minversion = 2.3.2 +envlist = py27,py35,py36,pep8 +minversion = 1.6 skipsdist = True [testenv] # Note the hash seed is set to 0 until heat can be tested with a # random hash seed successfully. setenv = VIRTUAL_ENV={envdir} + PYTHONWARNINGS=default::DeprecationWarning + OS_TEST_PATH=gbpautomation/heat/tests PYTHONHASHSEED=0 usedevelop = True install_command = pip install {opts} {packages} deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/rocky} + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/stein} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = - python setup.py testr --slowest --testr-args='^(?!functionaltests) {posargs}' + stestr run '^(?!functionaltests){posargs}' + stestr slowest -whitelist_externals = bash +whitelist_externals = + bash + # to avoid deprecation warning due to 'find' in cover env. + find [testenv:functional] commands = python -c "print('TODO: functional tests')" [testenv:pep8] +basepython = python3 commands = flake8 # Check that .po and .pot files are valid: # bash -c "find gbpautomation -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null" [testenv:venv] +basepython = python3 commands = {posargs} [testenv:cover] +basepython = python3 +setenv = + PYTHON=coverage run --source gbpautomation --parallel-mode commands = - python setup.py testr --coverage --testr-args='{posargs}' + coverage erase + find {toxinidir} -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:docs] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - sphinxcontrib-httpdomain -commands = python setup.py build_sphinx +basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt +commands = + rm -rf doc/build + sphinx-build -W -b html doc/source doc/build/html [flake8] # H302 import only modules.'bla..' does not import a module @@ -50,3 +68,15 @@ ignore = H302,H404,H803 show-source = true builtins = _ exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build + +[testenv:bindep] +basepython = python3 +# Do not install any requirements. We want this to be fast and work even if +# system dependencies are missing, since it's used to tell you what system +# dependencies are missing! This also means that bindep must be installed +# separately, outside of the requirements files, and develop mode disabled +# explicitly to avoid unnecessarily installing the checked-out repo too (this +# further relies on "tox.skipsdist = True" above). +deps = bindep +commands = bindep test +usedevelop = False