refine and fix unit test
This commit is contained in:
parent
d1a2d9d104
commit
787c0484b1
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,8 +1,7 @@
|
||||
*.pyc
|
||||
*.egg
|
||||
*.egg-info
|
||||
.DS_Store
|
||||
docs/_build
|
||||
/build
|
||||
/dist
|
||||
|
||||
>>>>>>> aee2b719b27498f1b3dcbb1909a8443ff6d1cf9f
|
||||
|
@ -56,21 +56,21 @@
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="radio_choice" type="radio" value="0" />
|
||||
<input id="id_radio_choice_0" name="radio_choice" type="radio" value="0" />
|
||||
Zero
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="radio_choice" type="radio" value="1" />
|
||||
<input id="id_radio_choice_1" name="radio_choice" type="radio" value="1" />
|
||||
One
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="radio_choice" type="radio" value="2" />
|
||||
<input id="id_radio_choice_2" name="radio_choice" type="radio" value="2" />
|
||||
Two
|
||||
</label>
|
||||
</div>
|
@ -56,21 +56,21 @@
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="radio_choice" type="radio" value="0" />
|
||||
<input id="id_radio_choice_0" name="radio_choice" type="radio" value="0" />
|
||||
Zero
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="radio_choice" type="radio" value="1" />
|
||||
<input id="id_radio_choice_1" name="radio_choice" type="radio" value="1" />
|
||||
One
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="radio_choice" type="radio" value="2" />
|
||||
<input id="id_radio_choice_2" name="radio_choice" type="radio" value="2" />
|
||||
Two
|
||||
</label>
|
||||
</div>
|
@ -1,12 +1,4 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
|
||||
|
||||
parent = os.path.dirname(os.path.dirname(
|
||||
os.path.abspath(__file__)))
|
||||
|
||||
sys.path.insert(0, parent)
|
||||
|
||||
from django.test import TestCase
|
||||
from django.template import Template, Context
|
||||
@ -36,6 +28,8 @@ class ExampleForm(forms.Form):
|
||||
|
||||
|
||||
class BootstrapTemplateTagTests(TestCase):
|
||||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
call_command('syncdb', interactive=False)
|
||||
|
56
runtests.py
Normal file
56
runtests.py
Normal file
@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import django
|
||||
from os.path import dirname, abspath
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
|
||||
settings.configure(
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': ':memory:'
|
||||
}
|
||||
},
|
||||
INSTALLED_APPS=[
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'bootstrapform',
|
||||
],
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
),
|
||||
SITE_ID=1,
|
||||
DEBUG=False,
|
||||
ROOT_URLCONF='',
|
||||
)
|
||||
|
||||
|
||||
|
||||
def runtests(**test_args):
|
||||
from django.test.utils import get_runner
|
||||
|
||||
parent = dirname(abspath(__file__))
|
||||
sys.path.insert(0, parent)
|
||||
|
||||
django.setup()
|
||||
|
||||
TestRunner = get_runner(settings)
|
||||
test_runner = TestRunner(verbosity=1, interactive=True)
|
||||
failures = test_runner.run_tests(['bootstrapform'], test_args)
|
||||
sys.exit(failures)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
runtests(*sys.argv[1:])
|
2
setup.py
2
setup.py
@ -21,7 +21,7 @@ setup(
|
||||
author_email='tzangms@gmail.com',
|
||||
url='http://github.com/tzangms/django-bootstrap-form',
|
||||
license='BSD',
|
||||
test_suite='tests',
|
||||
test_suite='runtests.runtests',
|
||||
install_requires = [
|
||||
"django>=1.3",
|
||||
],
|
||||
|
@ -1,41 +0,0 @@
|
||||
import os
|
||||
local_path = lambda path: os.path.join(os.path.dirname(__file__), path)
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': ':memory:'
|
||||
}
|
||||
}
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.admin',
|
||||
'bootstrapform',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'tests.urls'
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
MEDIA_ROOT = local_path('media')
|
||||
|
||||
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
|
||||
STATIC_ROOT = local_path('static/')
|
||||
STATIC_URL = '/static/'
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
|
||||
)
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
local_path('templates'),
|
||||
)
|
||||
|
||||
SECRET_KEY = 'django-bootstrap-form'
|
Loading…
Reference in New Issue
Block a user