Check for oslo library usage

Occasionally oslo library usage sneaks in, so add a coding check
that checks for ^oslo\. in requirements.txt. We currently still
use oslo.test, so don't check test-requirements.txt. This should
fail to pass tests until I34357d5a594330d07f5cad372859d98efb5d3fde
merges.

Change-Id: I53108584ee47a7f1b6c7df90c49f95725cec69f9
This commit is contained in:
Terry Wilson 2018-08-20 16:40:59 -05:00
parent b4f90d0490
commit f4855dd66f
3 changed files with 28 additions and 4 deletions

View File

@ -1,4 +1,14 @@
ovsdbapp Style Commandments
===============================================
===========================
Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/
- Step 1: Read the OpenStack Style Commandments
https://docs.openstack.org/hacking/latest/
- Step 2: Read on
ovsdbapp-specific Commandments
------------------------------
- ovsdbapp is intended to be a simple wrapper on top of python-ovs. As such,
it must build and be deployable without any OpenStack dependencies (oslo
projects included). It does currently use oslo.test for testing.

View File

@ -27,12 +27,22 @@ process_options () {
case $opt in
-h|--help) usage;;
-Y|--pylint) pylint=1;;
-O|--oslo) oslo=1;;
-a|--all) oslo=1; pylint=1;;
*) join_args;;
esac
i=$((i+1))
done
}
run_oslo () {
echo "Checking for oslo libraries in requirements.txt..."
if grep -q "^oslo[.-]" requirements.txt; then
echo "oslo libraries are not allowed"
exit 1
fi
}
run_pylint () {
local target="${scriptargs:-all}"
@ -56,10 +66,14 @@ run_pylint () {
}
scriptargs=
pylint=1
pylint=0
oslo=0
process_options $@
if [ $oslo -eq 1 ]; then
run_oslo
fi
if [ $pylint -eq 1 ]; then
run_pylint
exit 0

View File

@ -19,7 +19,7 @@ commands = stestr run --slowest {posargs}
[testenv:pep8]
basepython = python2.7
commands = flake8
{toxinidir}/tools/coding-checks.sh --pylint '{posargs}'
{toxinidir}/tools/coding-checks.sh --all '{posargs}'
[testenv:venv]
commands = {posargs}