From eb76117ed992544a4815ab3a1d68dca633d1574b Mon Sep 17 00:00:00 2001 From: lonnen Date: Sat, 20 Jul 2013 20:17:01 -0700 Subject: [PATCH] bug 895771 - merge setup-test and coverage built targets into test --- .gitignore | 1 + Makefile | 25 +++++++++++++++---------- scripts/build.sh | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index a80ee5f6a3..9fa19ddf6c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ stackwalk/ exploitable/ docs/_build/ *~ +coverage.xml .coverage cover/ .vagrant diff --git a/Makefile b/Makefile index e5364c0897..05ecf21cf7 100644 --- a/Makefile +++ b/Makefile @@ -18,18 +18,24 @@ JENKINS_CONF = jenkins.py.dist all: test -setup-test: bootstrap-dev +test: test-socorro test-webapp + +test-socorro: bootstrap-dev # jenkins only settings for the pre-configman components # can be removed when all tests are updated to use configman if [ $(WORKSPACE) ]; then cd socorro/unittest/config; cp $(JENKINS_CONF) commonconfig.py; fi; - + # setup any unset test configs and databases without overwriting existing files cd config; for file in *.ini-dist; do if [ ! -f `basename $$file -dist` ]; then cp $$file `basename $$file -dist`; fi; done PYTHONPATH=$(PYTHONPATH) $(SETUPDB) --database_name=socorro_integration_test --database_username=$(DB_USER) --database_hostname=$(DB_HOST) --database_password=$(DB_PASSWORD) --database_port=$(DB_PORT) --database_superusername=$(DB_SUPERUSER) --database_superuserpassword=$(DB_SUPERPASSWORD) --dropdb PYTHONPATH=$(PYTHONPATH) $(SETUPDB) --database_name=socorro_test --database_username=$(DB_USER) --database_hostname=$(DB_HOST) --database_password=$(DB_PASSWORD) --database_port=$(DB_PORT) --database_superusername=$(DB_SUPERUSER) --database_superuserpassword=$(DB_SUPERPASSWORD) --dropdb --no_schema cd socorro/unittest/config; for file in *.py.dist; do if [ ! -f `basename $$file .dist` ]; then cp $$file `basename $$file .dist`; fi; done + # run tests with coverage + rm -f coverage.xml + PYTHONPATH=$(PYTHONPATH) DB_HOST=$(DB_HOST) $(COVERAGE) run $(NOSE) + $(COVERAGE) xml -test: setup-test - PYTHONPATH=$(PYTHONPATH) $(NOSE) +test-webapp: bootstrap-webapp + # run tests bootstrap: git submodule update --init --recursive @@ -44,6 +50,11 @@ bootstrap-dev: bootstrap # install dev + prod dependencies $(VIRTUALENV)/bin/pip install --use-mirrors --download-cache=./pip-cache -r requirements/dev.txt +bootstrap-webapp: bootstrap + $(VIRTUALENV)/bin/pip install -q -r webapp-django/requirements/dev.txt + $(VIRTUALENV)/bin/pip install --install-option="--home=`pwd`/webapp-django/vendor-local" -r webapp-django/requirements/prod.txt + $(VIRTUALENV)/bin/pip install --install-option="--home=`pwd`/webapp-django/vendor-local" -r webapp-django/requirements/compiled.txt + install: bootstrap-prod reinstall # this a dev-only option, `make install` needs to be run at least once in the checkout (or after `make clean`) @@ -73,12 +84,6 @@ install-socorro: webapp-django # copy default config files cd $(PREFIX)/application/scripts/config; for file in *.py.dist; do cp $$file `basename $$file .dist`; done - -coverage: setup-test - rm -f coverage.xml - PYTHONPATH=$(PYTHONPATH) DB_HOST=$(DB_HOST) $(COVERAGE) run $(NOSE) - $(COVERAGE) xml - lint: rm -f pylint.txt $(PYLINT) -f parseable --rcfile=pylintrc socorro > pylint.txt diff --git a/scripts/build.sh b/scripts/build.sh index 1d65ed3748..84f759735d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -48,7 +48,7 @@ export RABBITMQ_VHOST="socorro-jenkins" export PATH=/usr/pgsql-9.2/bin:$PATH echo "My path is $PATH" # run unit tests -make coverage DB_USER=test DB_HOST=$DB_HOST DB_PASSWORD=aPassword DB_SUPERUSER=test DB_SUPERPASSWORD=aPassword +make test DB_USER=test DB_HOST=$DB_HOST DB_PASSWORD=aPassword DB_SUPERUSER=test DB_SUPERPASSWORD=aPassword # pull pre-built, known version of breakpad make clean