diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000..c58219e418 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,25 @@ +[run] +source = ansibleworks +branch = True +omit = ansibleworks/main/migrations/* + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about missing debug-only code: + def __repr__ + if self\.debug + + # Don't complain if tests don't hit defensive assertion code: + raise AssertionError + raise NotImplementedError + + # Don't complain if non-runnable code isn't run: + if 0: + if __name__ == .__main__.: + +ignore_errors = True + diff --git a/.gitignore b/.gitignore index 83db0826e7..6c284453ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,16 @@ ansibleworks/settings/local_settings.py* -ansibleworks/acom.sqlite3 +ansibleworks/*.sqlite3 ansibleworks/projects ansibleworks/public/media ansibleworks/public/static env/* build dist +htmlcov +*.egg-info *.py[c,o] *.swp +.coverage +coverage.xml +pep8.txt + diff --git a/Makefile b/Makefile index 45d61e0d56..118cebac71 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,14 @@ dbshell: test: python manage.py test main +test_coverage: + # Run tests with coverage enabled. + coverage run manage.py test main + +coverage_html: + # Output test coverage as HTML (into htmlcov directory). + coverage html + dev_build: python setup.py dev_build diff --git a/app_setup/setup.yml b/app_setup/setup.yml index 7da21689cb..ffcea6b52c 100644 --- a/app_setup/setup.yml +++ b/app_setup/setup.yml @@ -28,7 +28,11 @@ - python-devel # only because pexpect comes from pip - python-lxml # xml for ?format=xml instead of json (optional) - - name: install python modules from pip + # python-setuptools package is old (0.6.10, ~2009) vs. latest distribute (0.6.40) + - name: install latest distribute from pypi + pip: name=distribute state=latest + + - name: install python modules via pip pip: requirements=${working_dir}/requirements.txt - name: configure the database authentication more or less open for setup diff --git a/app_setup/templates/local_settings.py.j2 b/app_setup/templates/local_settings.py.j2 index b6435d0fed..71f28124e1 100644 --- a/app_setup/templates/local_settings.py.j2 +++ b/app_setup/templates/local_settings.py.j2 @@ -1,21 +1,7 @@ -# Local Django settings for Ansible Commander project. - # Copyright (c) 2013 AnsibleWorks, Inc. -# -# This file is part of Ansible Commander. -# -# Ansible Commander is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Ansible Commander is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible Commander. If not, see . +# All Rights Reserved. +# Local Django settings for AnsibleWorks project. from development import * diff --git a/requirements.txt b/requirements.txt index 4d337bd330..bf1c51c640 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,26 @@ -Django==1.5.1 -django-celery==3.0.11 -django-devserver==0.5.0 -django-extensions==1.1.1 -django-jsonfield==0.9.2 -ipython==0.13.1 -pexpect==2.4 -# psycopg2==2.4.6 -python-dateutil==1.5 -# PyYAML==3.10 -South==0.7.6 -requests -djangorestframework -markdown +# PIP requirements for AnsibleWorks development/build environment. +# Install using "pip -r requirements.txt" + +Django>=1.5 +django-celery +django-devserver +django-extensions django-filter +django-jsonfield +djangorestframework +ipython +markdown +pexpect +python-dateutil +PyYAML +South + +# You may also need to install the following extra packages using the OS +# package manager, or pip if you're running inside a virtualenv. +# - ansible (via yum, pip or source checkout) +# - distribute (Use the latest version via "pip install -U distribute"; the +# default python-setuptools package is old.) +# - psycopg2 (via "yum install python-psycopg2") +# - coverage (if you want to check test coverage, via "pip install coverage"; +# the default python-coverage package is old.) +# - readline (for using the ipython interactive shell)