From 1118b29c7e4b9cbec673f36dcf16b885a2764361 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 25 Jul 2012 15:19:39 -0700 Subject: [PATCH] Add run_tests flag to run only selenium tests. The new Jenkins job to run the selenium tests is running all of the python27 unittests as well which have their own job. Add a new flag, --only-selenium, to run only the selenium tests. This will allow Jenkins to better partition work and prevent redundancy. Change-Id: I70aac3b843434736159c4266b41f6ebd1f5109c7 --- horizon/test.py | 2 ++ run_tests.sh | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/horizon/test.py b/horizon/test.py index e0844eb84..4d70a4976 100644 --- a/horizon/test.py +++ b/horizon/test.py @@ -91,6 +91,8 @@ class RequestFactoryWithMessages(RequestFactory): return req +@unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False), + "The SKIP_UNITTESTS env variable is set.") class TestCase(django_test.TestCase): """ Specialized base test case class for Horizon which gives access to diff --git a/run_tests.sh b/run_tests.sh index fb5b05a8d..868faed21 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -28,6 +28,7 @@ function usage { echo " -y, --pylint Just run pylint" echo " -q, --quiet Run non-interactively. (Relatively) quiet." echo " Implies -V if -N is not set." + echo " --only-selenium Run only the Selenium unit tests" echo " --with-selenium Run unit tests including Selenium tests" echo " --runserver Run the Django development server for" echo " openstack_dashboard in the virtual" @@ -65,7 +66,8 @@ never_venv=0 quiet=0 restore_env=0 runserver=0 -selenium=0 +only_selenium=0 +with_selenium=0 testargs="" with_coverage=0 makemessages=0 @@ -87,7 +89,8 @@ function process_option { -c|--coverage) with_coverage=1;; -m|--manage) manage=1;; --makemessages) makemessages=1;; - --with-selenium) selenium=1;; + --only-selenium) only_selenium=1;; + --with-selenium) with_selenium=1;; --docs) just_docs=1;; --runserver) runserver=1;; --backup-environment) backup_env=1;; @@ -259,8 +262,11 @@ function install_venv { function run_tests { sanity_check - if [ $selenium -eq 1 ]; then + if [ $with_selenium -eq 1 ]; then export WITH_SELENIUM=1 + elif [ $only_selenium -eq 1 ]; then + export WITH_SELENIUM=1 + export SKIP_UNITTESTS=1 fi echo "Running Horizon application tests"