diff options
-rw-r--r-- | .coveragerc | 2 | ||||
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | awx/api/tests/job_tasks.py | 2 | ||||
-rw-r--r-- | awx/main/models/credential.py | 1 | ||||
-rw-r--r-- | awx/main/tests/functional/ad_hoc.py | 6 | ||||
-rw-r--r-- | awx/main/tests/functional/jobs/job_launch.py | 2 | ||||
-rw-r--r-- | awx/main/tests/functional/jobs/job_relaunch.py | 2 | ||||
-rw-r--r-- | awx/main/tests/functional/jobs/jobs_monolithic.py | 2 | ||||
-rw-r--r-- | awx/main/tests/functional/jobs/start_cancel.py | 2 | ||||
-rw-r--r-- | awx/main/tests/job_base.py (renamed from awx/main/tests/functional/jobs/job_base.py) | 4 | ||||
-rw-r--r-- | awx/main/utils.py | 1 | ||||
-rw-r--r-- | requirements/requirements_jenkins.txt | 4 | ||||
-rw-r--r-- | tools/docker-compose/Dockerfile | 5 |
13 files changed, 26 insertions, 19 deletions
diff --git a/.coveragerc b/.coveragerc index d7a734c1d6..f9ef3447bf 100644 --- a/.coveragerc +++ b/.coveragerc @@ -25,3 +25,5 @@ exclude_lines = ignore_errors = True +[xml] +output = ./reports/coverage.xml @@ -155,7 +155,7 @@ endif .PHONY: clean rebase push requirements requirements_dev requirements_jenkins \ real-requirements real-requirements_dev real-requirements_jenkins \ develop refresh adduser syncdb migrate dbchange dbshell runserver celeryd \ - receiver test test_coverage coverage_html test_jenkins dev_build \ + receiver test test_unit test_coverage coverage_html test_jenkins dev_build \ release_build release_clean sdist rpmtar mock-rpm mock-srpm rpm-sign \ build-ui sync-ui test-ui build-ui-for-coverage test-ui-for-coverage \ build-ui-for-browser-tests test-ui-debug jshint ngdocs \ @@ -360,14 +360,14 @@ check: flake8 pep8 # pyflakes pylint # Run all API unit tests. test: - $(PYTHON) -m py.test awx/main/tests + py.test awx/main/tests awx/api/tests awx/fact/tests test_unit: - $(PYTHON) -m py.test awx/main/tests/unit + py.test awx/main/tests/unit # Run all API unit tests with coverage enabled. test_coverage: - $(PYTHON) -m py.test --cov=awx awx/main/tests + py.test --cov=awx --cov-report=xml --junitxml=./reports/junit.xml awx/main/tests awx/api/tests awx/fact/tests # Output test coverage as HTML (into htmlcov directory). coverage_html: @@ -378,8 +378,8 @@ test_tox: tox -v # Run unit tests to produce output for Jenkins. -test_jenkins: - $(PYTHON) manage.py jenkins -v2 --enable-coverage --project-apps-tests +# Alias existing make target so old versions run against Jekins the same way +test_jenkins : test_coverage # UI TASKS # -------------------------------------- diff --git a/awx/api/tests/job_tasks.py b/awx/api/tests/job_tasks.py index 36c7eb6fb0..93861f8d56 100644 --- a/awx/api/tests/job_tasks.py +++ b/awx/api/tests/job_tasks.py @@ -5,7 +5,7 @@ from django.conf import settings from django.test import LiveServerTestCase from django.test.utils import override_settings -from awx.main.tests.jobs import BaseJobTestMixin +from awx.main.tests.job_base import BaseJobTestMixin @override_settings(CELERY_ALWAYS_EAGER=True, diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index c72c67b715..8f0d32d87a 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -470,3 +470,4 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique): if 'cloud' not in update_fields: update_fields.append('cloud') super(Credential, self).save(*args, **kwargs) + diff --git a/awx/main/tests/functional/ad_hoc.py b/awx/main/tests/functional/ad_hoc.py index d0e75d2f19..41993f885b 100644 --- a/awx/main/tests/functional/ad_hoc.py +++ b/awx/main/tests/functional/ad_hoc.py @@ -19,7 +19,11 @@ from crum import impersonate from awx.main.utils import * # noqa from awx.main.models import * # noqa from awx.main.tests.base import BaseJobExecutionTest -from tasks import TEST_SSH_KEY_DATA, TEST_SSH_KEY_DATA_LOCKED, TEST_SSH_KEY_DATA_UNLOCK +from awx.main.tests.data.ssh import ( + TEST_SSH_KEY_DATA, + TEST_SSH_KEY_DATA_LOCKED, + TEST_SSH_KEY_DATA_UNLOCK, +) __all__ = ['RunAdHocCommandTest', 'AdHocCommandApiTest'] diff --git a/awx/main/tests/functional/jobs/job_launch.py b/awx/main/tests/functional/jobs/job_launch.py index 00bfbb8b2b..4d1899de09 100644 --- a/awx/main/tests/functional/jobs/job_launch.py +++ b/awx/main/tests/functional/jobs/job_launch.py @@ -10,7 +10,7 @@ from django.core.urlresolvers import reverse # AWX from awx.main.models import * # noqa -from job_base import BaseJobTestMixin +from awx.main.tests.job_base import BaseJobTestMixin import yaml __all__ = ['JobTemplateLaunchTest', 'JobTemplateLaunchPasswordsTest'] diff --git a/awx/main/tests/functional/jobs/job_relaunch.py b/awx/main/tests/functional/jobs/job_relaunch.py index 0c9eff99bd..437c6ed099 100644 --- a/awx/main/tests/functional/jobs/job_relaunch.py +++ b/awx/main/tests/functional/jobs/job_relaunch.py @@ -11,7 +11,7 @@ from django.core.urlresolvers import reverse # AWX from awx.main.models import * # noqa from awx.main.tests.base import BaseLiveServerTest -from job_base import BaseJobTestMixin +from awx.main.tests.job_base import BaseJobTestMixin __all__ = ['JobRelaunchTest',] diff --git a/awx/main/tests/functional/jobs/jobs_monolithic.py b/awx/main/tests/functional/jobs/jobs_monolithic.py index 0ea0661cd7..72283f29f9 100644 --- a/awx/main/tests/functional/jobs/jobs_monolithic.py +++ b/awx/main/tests/functional/jobs/jobs_monolithic.py @@ -22,7 +22,7 @@ import requests # AWX from awx.main.models import * # noqa -from job_base import BaseJobTestMixin +from awx.main.tests.job_base import BaseJobTestMixin __all__ = ['JobTemplateTest', 'JobTest', 'JobTemplateCallbackTest', 'JobTransactionTest', 'JobTemplateSurveyTest'] diff --git a/awx/main/tests/functional/jobs/start_cancel.py b/awx/main/tests/functional/jobs/start_cancel.py index afacb4f863..e57c70ef15 100644 --- a/awx/main/tests/functional/jobs/start_cancel.py +++ b/awx/main/tests/functional/jobs/start_cancel.py @@ -11,7 +11,7 @@ from django.conf import settings # AWX from awx.main.models import * # noqa from awx.main.tests.base import BaseLiveServerTest -from job_base import BaseJobTestMixin +from awx.main.tests.job_base import BaseJobTestMixin __all__ = ['JobStartCancelTest',] diff --git a/awx/main/tests/functional/jobs/job_base.py b/awx/main/tests/job_base.py index 769ba406a5..5b7408d19d 100644 --- a/awx/main/tests/functional/jobs/job_base.py +++ b/awx/main/tests/job_base.py @@ -257,8 +257,8 @@ class BaseJobTestMixin(BaseTestMixin): # Each user has his/her own set of credentials. from awx.main.tests.data.ssh import (TEST_SSH_KEY_DATA, - TEST_SSH_KEY_DATA_LOCKED, - TEST_SSH_KEY_DATA_UNLOCK) + TEST_SSH_KEY_DATA_LOCKED, + TEST_SSH_KEY_DATA_UNLOCK) self.cred_sue = self.user_sue.credentials.create( username='sue', password=TEST_SSH_KEY_DATA, diff --git a/awx/main/utils.py b/awx/main/utils.py index 5b9b7a1f46..110df9a5fd 100644 --- a/awx/main/utils.py +++ b/awx/main/utils.py @@ -20,7 +20,6 @@ import tempfile from rest_framework.exceptions import ParseError, PermissionDenied from django.utils.encoding import smart_str from django.core.urlresolvers import reverse -from django.core.exceptions import ValidationError # PyCrypto from Crypto.Cipher import AES diff --git a/requirements/requirements_jenkins.txt b/requirements/requirements_jenkins.txt index 8ccdb6c3a1..7ea9c8642f 100644 --- a/requirements/requirements_jenkins.txt +++ b/requirements/requirements_jenkins.txt @@ -9,3 +9,7 @@ pylint flake8 distribute==0.7.3 unittest2 +pytest +pytest-cov +pytest-django +pytest-pythonpath diff --git a/tools/docker-compose/Dockerfile b/tools/docker-compose/Dockerfile index e2e57fd4a1..b4a25a78cc 100644 --- a/tools/docker-compose/Dockerfile +++ b/tools/docker-compose/Dockerfile @@ -12,10 +12,7 @@ RUN echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-or RUN apt-get update RUN apt-get install -y openssh-server ansible mg vim tmux git mercurial subversion python-dev python-psycopg2 make postgresql-client libpq-dev nodejs python-psutil libxml2-dev libxslt-dev lib32z1-dev libsasl2-dev libldap2-dev libffi-dev libzmq-dev proot python-pip libxmlsec1-dev swig redis-server && rm -rf /var/lib/apt/lists/* RUN pip install flake8 -RUN pip install pytest -RUN pip install pytest-pythonpath -RUN pip install pytest-django -RUN pip install pytest-cov +RUN pip install pytest pytest-pythonpath pytest-django pytest-cov RUN /usr/bin/ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa RUN mkdir -p /etc/tower RUN mkdir -p /data/db |