diff --git a/Makefile b/Makefile index f60c10b0c5..cba8682e55 100644 --- a/Makefile +++ b/Makefile @@ -175,7 +175,7 @@ test_tox: # Run unit tests to produce output for Jenkins. test_jenkins: - DJANGO_SETTINGS_MODULE="awx.settings.jenkins" $(PYTHON) manage.py jenkins -v2 + $(PYTHON) manage.py jenkins -v2 package.json: sed -e 's/%NAME%/$(NAME)/;s/%VERSION%/$(VERSION)/' packaging/grunt/package.template > $@ diff --git a/awx/settings/development.py b/awx/settings/development.py index 5210e6f71c..fbdb3099bc 100644 --- a/awx/settings/development.py +++ b/awx/settings/development.py @@ -6,6 +6,7 @@ # Python import sys import traceback +import glob # Django Split Settings from split_settings.tools import optional, include @@ -22,6 +23,29 @@ if 'celeryd' in sys.argv: CALLBACK_CONSUMER_PORT = "tcp://127.0.0.1:5557" CALLBACK_QUEUE_PORT = "ipc:///tmp/callback_receiver_dev.ipc" +# Use Django-Jenkins if installed. Only run tests for awx.main app. +try: + import django_jenkins + INSTALLED_APPS += ('django_jenkins',) + PROJECT_APPS = ('awx.main', 'awx.api',) +except ImportError: + pass + +if 'django_jenkins' in INSTALLED_APPS: + JENKINS_TASKS = ( + 'django_jenkins.tasks.run_pylint', + 'django_jenkins.tasks.with_coverage', + 'django_jenkins.tasks.django_tests', + 'django_jenkins.tasks.run_pep8', + 'django_jenkins.tasks.run_pyflakes', + 'django_jenkins.tasks.run_jshint', + 'django_jenkins.tasks.run_csslint', + ) + PEP8_RCFILE = "setup.cfg" + CSSLINT_CHECKED_FILES = glob.glob(os.path.join(BASE_DIR, 'ui/static/less/*.less')) + JSHINT_CHECKED_FILES = [os.path.join(BASE_DIR, 'ui/static/js'), + os.path.join(BASE_DIR, 'ui/static/lib/ansible'),] + # If any local_*.py files are present in awx/settings/, use them to override # default settings for development. If not present, we can still run using # only the defaults. diff --git a/awx/settings/jenkins.py b/awx/settings/jenkins.py index 0caa4c7177..282319b503 100644 --- a/awx/settings/jenkins.py +++ b/awx/settings/jenkins.py @@ -1,13 +1,7 @@ # Copyright (c) 2014 AnsibleWorks, Inc. # All Rights Reserved. -# Test settings for AWX project. - -# Python -import glob - -# Django Split Settings -from split_settings.tools import optional, include +# Development settings for AWX project, but with DEBUG disabled # Load development settings. from defaults import * @@ -19,22 +13,3 @@ from development import * DEBUG = False TEMPLATE_DEBUG = DEBUG SQL_DEBUG = DEBUG - -# Use Django-Jenkins if installed. Only run tests for awx.main app. -import django_jenkins -INSTALLED_APPS += ('django_jenkins',) -PROJECT_APPS = ('awx.main', 'awx.api',) - -JENKINS_TASKS = ( - 'django_jenkins.tasks.run_pylint', - 'django_jenkins.tasks.with_coverage', - # 'django_jenkins.tasks.django_tests', - 'django_jenkins.tasks.run_pep8', - 'django_jenkins.tasks.run_pyflakes', - 'django_jenkins.tasks.run_jshint', - 'django_jenkins.tasks.run_csslint', - ) -PEP8_RCFILE = "setup.cfg" -CSSLINT_CHECKED_FILES = glob.glob(os.path.join(BASE_DIR, 'ui/static/less/*.less')) -JSHINT_CHECKED_FILES = [os.path.join(BASE_DIR, 'ui/static/js'), - os.path.join(BASE_DIR, 'ui/static/lib/ansible'),]