[python-bugzilla] [PATCH 1/2] Skip tests if virtual environment is not active

abn at redhat.com abn at redhat.com
Wed Dec 18 05:12:50 UTC 2013


From: Arun Babu Neelicattu <abn at redhat.com>

---
 contrib/run-tests | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/contrib/run-tests b/contrib/run-tests
index d9e34ce..285184e 100755
--- a/contrib/run-tests
+++ b/contrib/run-tests
@@ -11,10 +11,15 @@ ARGS="$@"
 
 for BIN in python2 python3; do
     if command -v ${BIN} >/dev/null 2>&1; then
-        echo "INFO: Running tests for ${BIN}"
+        echo "INFO: Activating environment for ${BIN}"
         . ./contrib/activate-dev-env ${BIN}
-        python setup.py test ${ARGS}
-        echo "INFO: Tests completed for ${BIN}"
+        if [ -z ${VIRTUAL_ENV} ]; then
+            echo "WARN: Virtual Environment not active, skipping tests."
+        else
+            echo "INFO: Running tests for ${BIN}"
+            python setup.py test ${ARGS}
+            echo "INFO: Tests completed for ${BIN}"
+        fi
     else
         echo "INFO: ${BIN} not found, skipping tests."
     fi
-- 
1.8.1.4



More information about the python-bugzilla mailing list