Skip to content

Commit

Permalink
Updated project settings setup
Browse files Browse the repository at this point in the history
  • Loading branch information
micahhausler committed Jul 16, 2014
1 parent 534ad09 commit bb15362
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 83 deletions.
14 changes: 14 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[run]
branch = True
omit =
manager_utils/version.py
source = {{ project_name }}
[report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError
fail_under = 100
show_missing = 1
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
language: python
python:
- '2.7'
- '3.3'
- '3.4'
env:
global:
- DB=postgres
matrix:
- DJANGO=1.6.2
- DJANGO=1.6.5
install:
- pip install -q coverage flake8 Django==$DJANGO
before_script:
- flake8 . --max-line-length=120 --max-complexity=10 --exclude='env,migrations,*.egg'
- psql -c 'CREATE DATABASE manager_utils;' -U postgres
script:
- coverage run --source='manager_utils' --branch --omit='manager_utils/migrations/*' setup.py test
- coverage report --fail-under=100 --show-missing
- flake8 .
- coverage run setup.py test
- coverage report --fail-under=100
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Wes Kendall @wesleykendall wes.kendall@ambition.com (primary)
Micah Hausler @micahhausler micah.hausler@ambition.com
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include README.md
include README.rst
include LICENSE
25 changes: 25 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. image:: https://travis-ci.org/ambitioninc/django-manager-utils.png
:target: https://travis-ci.org/ambitioninc/django-manager-utils

django-manager-utils
====================
Additional utilities for Django model managers.

Installation
------------
To install the latest release, type::

pip install django-manager-utils

To install the latest code directly from source, type::

pip install git+git://github.com/ambitioninc/django-manager-utils.git

Documentation
-------------

Full documentation is available at http://django-manager-utils.readthedocs.org

License
-------
MIT License (see LICENSE)
6 changes: 4 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env python
import os
import sys

from settings import configure_settings


if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'test_project.settings')
configure_settings()

from django.core.management import execute_from_command_line

Expand Down
2 changes: 1 addition & 1 deletion manager_utils/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.6.0'
__version__ = '0.6.1'
72 changes: 0 additions & 72 deletions run_tests.py

This file was deleted.

50 changes: 50 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import os

from django.conf import settings


def configure_settings():
"""
Configures settings for manage.py and for run_tests.py.
"""
if not settings.configured:
# Determine the database settings depending on if a test_db var is set in CI mode or not
test_db = os.environ.get('DB', None)
if test_db is None:
db_config = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'ambition_dev',
'USER': 'ambition_dev',
'PASSWORD': 'ambition_dev',
'HOST': 'localhost'
}
elif test_db == 'postgres':
db_config = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'postgres',
'NAME': 'manager_utils',
}
elif test_db == 'sqlite':
db_config = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'manager_utils',
}
else:
raise RuntimeError('Unsupported test DB {0}'.format(test_db))

settings.configure(
DATABASES={
'default': db_config,
},
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'south',
'manager_utils',
'manager_utils.tests',
),
ROOT_URLCONF='manager_utils.urls',
DEBUG=False,
)
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 120
exclude = docs,env,*.egg,migrations
max-complexity = 10
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ def get_version():
name='django-manager-utils',
version=get_version(),
description='Model manager utilities for Django',
long_description=open('README.md').read(),
long_description=open('README.rst').read(),
url='http://github.com/ambitioninc/django-manager-utils/',
author='Wes Kendall',
author_email='opensource@ambition.com',
packages=find_packages(),
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Framework :: Django',
],
Expand Down

0 comments on commit bb15362

Please sign in to comment.