Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaaro committed Sep 23, 2014
1 parent fba38b1 commit 892093c
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ matrix:
- python: "2.6"
env: DJANGO=dev
install:
- pip install django==${DJANGO}
- pip install django==${DJANGO} Pillow
- pip install .
language: python
python:
Expand Down
3 changes: 2 additions & 1 deletion jsonate/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from jsonate.utils import jsonate
from jsonate.utils import jsonate
from . import monkey_patches
14 changes: 10 additions & 4 deletions jsonate/fields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from django.db import models
from django.utils import simplejson as json
try:
import json
except ImportError:
from django.utils import simplejson as json
from jsonate.utils import jsonate
from jsonate.widgets import JsonateWidget
from jsonate.form_fields import JsonateFormField
Expand Down Expand Up @@ -31,6 +34,9 @@ def formfield(self, **kwargs):
}
defaults.update(kwargs)
return super(JsonateField, self).formfield(**defaults)

from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^jsonate\.fields\.JsonateField"])

try:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^jsonate\.fields\.JsonateField"])
except ImportError:
pass
5 changes: 4 additions & 1 deletion jsonate/form_fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from django.forms import CharField, ValidationError
from jsonate.widgets import JsonateWidget
from django.utils import simplejson as json
try:
import json
except ImportError:
from django.utils import simplejson as json


def JsonateValidator(value):
Expand Down
5 changes: 4 additions & 1 deletion jsonate/json_encoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from datetime import datetime, date
from decimal import Decimal
from django.utils import simplejson as json
try:
import json
except ImportError:
from django.utils import simplejson as json
from django.db.models.query import QuerySet, ValuesQuerySet
from django.db.models import Model
from django.db.models.fields.related import ForeignKey
Expand Down
2 changes: 1 addition & 1 deletion jsonate/models.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import jsonate.monkey_patches #@UnusedImport
import jsonate.monkey_patches
5 changes: 4 additions & 1 deletion jsonate/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from django.utils import simplejson as json
try:
import json
except ImportError:
from django.utils import simplejson as json

from jsonate.json_encoder import JsonateEncoder

Expand Down
5 changes: 4 additions & 1 deletion jsonate/widgets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from django import forms
from django.utils import simplejson as json
try:
import json
except ImportError:
from django.utils import simplejson as json
from jsonate.utils import jsonate

class JsonateWidget(forms.Textarea):
Expand Down
9 changes: 7 additions & 2 deletions test_project/manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
from django.core.management import execute_manager

try:
import settings # Assumed to be in the same directory.
except ImportError:
Expand All @@ -8,4 +8,9 @@
sys.exit(1)

if __name__ == "__main__":
execute_manager(settings)
try:
from django.core.management import execute_from_command_line
execute_from_command_line()
except ImportError:
from django.core.management import execute_manager
execute_manager(settings)
7 changes: 4 additions & 3 deletions test_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
DEBUG = True
TEMPLATE_DEBUG = DEBUG

SECRET_KEY = "thisIsTotallyASecretJkLolHaHa!1!!1!"

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test_jsonate',
'USER': 'root'
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test_jsonate'
}
}

Expand Down

0 comments on commit 892093c

Please sign in to comment.