Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
154 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
language: python | ||
python: | ||
- "2.5" | ||
- "2.6" | ||
- "2.7" | ||
before_install: | ||
- export PIP_USE_MIRRORS=true | ||
- export PIP_INDEX_URL=https://simple.crate.io/ | ||
# - export PIP_INDEX_URL=https://simple.crate.io/ | ||
# - sudo apt-get update | ||
install: | ||
- pip install -e . | ||
- pip install -r requirements/tests.txt Django==$DJANGO | ||
- pip install Django==$DJANGO | ||
script: | ||
- make test | ||
env: | ||
- DJANGO=1.3.1 | ||
- DJANGO=1.4.13 | ||
- DJANGO=1.5.8 | ||
- DJANGO=1.6.5 | ||
branches: | ||
only: | ||
- develop | ||
- develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
# | ||
# Makefile | ||
# | ||
|
||
SHELL := /bin/bash | ||
VERSION = $(shell python setup.py --version) | ||
|
||
all: | ||
@echo "See Makefile source for targets details" | ||
|
||
test: | ||
cd country_dialcode/tests && python runtests.py | ||
|
||
oldtest: | ||
flake8 country_dialcode --ignore=E501,E128 | ||
coverage run --branch --source=country_dialcode `which django-admin.py` test --settings=country_dialcode.test_settings country_dialcode | ||
coverage report --omit=country_dialcode/test* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
|
||
class CountryDialcodeConfig(AppConfig): | ||
verbose_name = _('Country Dialcode') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import sys | ||
|
||
|
||
PY2 = sys.version_info[0] == 2 | ||
if not PY2: | ||
text_type = str | ||
binary_type = bytes | ||
string_types = (str,) | ||
integer_types = (int,) | ||
else: | ||
text_type = unicode | ||
binary_type = str | ||
string_types = basestring | ||
integer_types = (int, long) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .tests import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import sys | ||
|
||
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_settings' | ||
parent = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
|
||
sys.path.insert(0, parent) | ||
|
||
from django.test.simple import DjangoTestSuiteRunner | ||
|
||
|
||
def runtests(): | ||
return DjangoTestSuiteRunner(failfast=False).run_tests([ | ||
# 'country_dialcode.CountryDialcodeAdminView', | ||
'country_dialcode.CountryDialcodeModel', | ||
], verbosity=1, interactive=True) | ||
|
||
|
||
if __name__ == '__main__': | ||
if runtests(): | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
|
||
from country_dialcode.compatibility import text_type | ||
|
||
|
||
BASE_DIR = os.path.dirname(__file__) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.sessions', | ||
'django.contrib.contenttypes', | ||
'django.contrib.admin', | ||
'country_dialcode', | ||
) | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
} | ||
} | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'urls' | ||
SECRET_KEY = 'secretkey' | ||
SITE_ROOT = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
# http://djangosnippets.org/snippets/646/ | ||
class InvalidVarException(object): | ||
def __mod__(self, missing): | ||
try: | ||
missing_str = text_type(missing) | ||
except: | ||
missing_str = 'Failed to create string representation' | ||
raise Exception('Unknown template variable %r %s' % (missing, missing_str)) | ||
|
||
def __contains__(self, search): | ||
if search == '%s': | ||
return True | ||
return False | ||
|
||
|
||
TEMPLATE_DEBUG = True | ||
TEMPLATE_STRING_IF_INVALID = InvalidVarException() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from django.contrib.auth.models import User | ||
from django.test import TestCase, Client | ||
from django.test.client import RequestFactory | ||
import base64 | ||
import unittest | ||
|
||
|
||
def build_test_suite_from(test_cases): | ||
"""Returns a single or group of unittest test suite(s) that's ready to be | ||
run. The function expects a list of classes that are subclasses of | ||
TestCase. | ||
The function will search the module where each class resides and | ||
build a test suite from that class and all subclasses of it. | ||
""" | ||
test_suites = [] | ||
for test_case in test_cases: | ||
mod = __import__(test_case.__module__) | ||
components = test_case.__module__.split('.') | ||
for comp in components[1:]: | ||
mod = getattr(mod, comp) | ||
tests = [] | ||
for item in mod.__dict__.values(): | ||
if type(item) is type and issubclass(item, test_case): | ||
tests.append(item) | ||
test_suites.append(unittest.TestSuite( | ||
map(unittest.TestLoader().loadTestsFromTestCase, tests))) | ||
|
||
return unittest.TestSuite(test_suites) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.