Use the same style checking everywhere

Both the run_tests.sh and tox.ini using the same check_source.sh for
style and basic lint testing.

Adding a pyflakes based unused import test.

Removing 2 unused imports from
tempest/tests/network/test_network_basic_ops.py.

Change-Id: I5b4c8b945495751ac68fc64ed5ebf1cf441a5a31
This commit is contained in:
afazekas
2013-03-25 17:36:04 +01:00
committed by Attila Fazekas
parent 990a1894db
commit 4d1bee8d11
5 changed files with 27 additions and 11 deletions
+1 -8
View File
@@ -95,14 +95,7 @@ function run_tests {
function run_pep8 {
echo "Running pep8 ..."
srcfiles="`find tempest -type f -name "*.py"`"
srcfiles+=" `find tools -type f -name "*.py"`"
srcfiles+=" `find stress -type f -name "*.py"`"
srcfiles+=" setup.py"
ignore='--ignore=E121,E122,E125,E126'
${wrapper} python tools/hacking.py ${ignore} ${srcfiles}
${wrapper} tools/check_source.sh
}
function run_coverage_start {
@@ -16,9 +16,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from quantumclient.common import exceptions as exc
from tempest.common.utils.data_utils import rand_name
from tempest import test
from tempest.tests.network.common import DeletableRouter
from tempest.tests.network.common import TestNetworkSmokeCommon
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
python tools/hacking.py --ignore=E122,E125,E126 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,*egg .
pep8_ret=$?
pyflakes tempest stress setup.py tools cli bin | grep "imported but unused"
unused_ret=$?
ret=0
if [ $pep8_ret != 0 ]; then
echo "hacking.py/pep8 test FAILED!" >&2
(( ret += 1 ))
else
echo "hacking.py/pep8 test OK!" >&2
fi
if [ $unused_ret == 0 ]; then
echo "Unused import test FAILED!" >&2
(( ret += 2 ))
else
echo "Unused import test OK!" >&2
fi
exit $ret
+1
View File
@@ -2,3 +2,4 @@ pep8==1.3.3
pylint==0.19
#TODO(afazekas): ensure pg_config installed
psycopg2
pyflakes
+1 -1
View File
@@ -19,4 +19,4 @@ commands = python -m tools/tempest_coverage -c start --combine
python -m tools/tempest_coverage -c report --html
[testenv:pep8]
commands = python tools/hacking.py --ignore=E122,E125,E126 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,*egg .
commands = bash tools/check_source.sh