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
diff --git a/tools/check_source.sh b/tools/check_source.sh
new file mode 100755
index 0000000..089ad70
--- /dev/null
+++ b/tools/check_source.sh
@@ -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
diff --git a/tools/test-requires b/tools/test-requires
index b799dce..f701dab 100644
--- a/tools/test-requires
+++ b/tools/test-requires
@@ -2,3 +2,4 @@
pylint==0.19
#TODO(afazekas): ensure pg_config installed
psycopg2
+pyflakes