Fix run_tests.sh for tests, coverage report and pep8 checks

This patch incorporates the fix sent by Tomas:
https://review.openstack.org/#/c/41720
and also fixes the issue with coverage report and pep8 checks.

Fixes: bug #1211893 and bug #1211936

Change-Id: I619600552bd655a9832114b185f4a6806f57075f