From ace2c424f168d79c5a84fc9a1cc460a5825c5848 Mon Sep 17 00:00:00 2001 From: Anand Shanmugam Date: Wed, 27 May 2020 06:20:56 +0000 Subject: [PATCH] Disabling python27 unit tests and enabling zuul jobs Change-Id: I94bec5d6818cbf5d2e58589efdba7799cb6e02e7 --- .zuul.yaml | 7 +++++++ tools/flake8wrap.sh | 20 ++++++++++++++++++++ tox.ini | 23 +++++++++++++++-------- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 .zuul.yaml create mode 100755 tools/flake8wrap.sh diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..1fd1fe4 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,7 @@ +- project: + check: + jobs: + - openstack-tox-pep8 + gate: + jobs: + - openstack-tox-pep8 diff --git a/tools/flake8wrap.sh b/tools/flake8wrap.sh new file mode 100755 index 0000000..ab3269d --- /dev/null +++ b/tools/flake8wrap.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# A simple wrapper around flake8 which makes it possible +# to ask it to only verify files changed in the current +# git HEAD patch. +# +# Intended to be invoked via tox: +# +# tox -epep8 -- -HEAD +# + +if test "x$1" = "x-HEAD" ; then + shift + files=$(git diff --name-only HEAD~1 | tr '\n' ' ') + echo "Running flake8 on ${files}" + diff -u --from-file /dev/null ${files} | flake8 --diff "$@" +else + echo "Running flake8 on all files" + exec flake8 "$@" +fi diff --git a/tox.ini b/tox.ini index 67dd03f..aeb5975 100644 --- a/tox.ini +++ b/tox.ini @@ -1,22 +1,30 @@ [tox] minversion = 2.0 -envlist = py36,py27,pep8 +envlist = pep8 skipsdist = True [testenv] +basepython = python3 usedevelop = True -install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -commands = python setup.py test --slowest --testr-args='{posargs}' + PYTHONWARNINGS=default::DeprecationWarning + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 +deps = + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +passenv = TEMPEST_* OS_TEST_* +commands = + find . -type f -name "*.py[c|o]" -delete + stestr run {posargs} [testenv:pep8] -commands = flake8 +commands = + bash tools/flake8wrap.sh {posargs} [testenv:venv] -basepython = python3 commands = {posargs} [testenv:genconfig] @@ -42,7 +50,6 @@ commands = bandit -c bandit.yaml -r cloudpulse -p gate [flake8] # E123, E125 skipped as they are invalid PEP-8. - show-source = True ignore = E123,E125 builtins = _