setup.py: add command to run tests
also add url and settings file for running the tests
This commit is contained in:
parent
da289d52f1
commit
a5a2356495
26
setup.py
26
setup.py
|
@ -7,6 +7,27 @@ from distutils.command.build import build as _build
|
||||||
from distutils.command.sdist import sdist as _sdist
|
from distutils.command.sdist import sdist as _sdist
|
||||||
from distutils.cmd import Command
|
from distutils.cmd import Command
|
||||||
|
|
||||||
|
class test(Command):
|
||||||
|
description = 'run django tests'
|
||||||
|
user_options = []
|
||||||
|
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
import os
|
||||||
|
try:
|
||||||
|
from django.core.management import call_command
|
||||||
|
except ImportError:
|
||||||
|
raise RuntimeError('You need django in your PYTHONPATH')
|
||||||
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
|
||||||
|
call_command('test', 'django_journal')
|
||||||
|
|
||||||
|
|
||||||
class compile_translations(Command):
|
class compile_translations(Command):
|
||||||
description = 'compile message catalogs to MO files via django compilemessages'
|
description = 'compile message catalogs to MO files via django compilemessages'
|
||||||
user_options = []
|
user_options = []
|
||||||
|
@ -83,10 +104,11 @@ setup(name='django-journal',
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
cmdclass={'build': build, 'install_lib': install_lib,
|
cmdclass={'build': build, 'install_lib': install_lib,
|
||||||
'compile_translations': compile_translations,
|
'compile_translations': compile_translations,
|
||||||
'sdist': sdist},
|
'sdist': sdist,
|
||||||
|
'test': test},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'django >= 1.4.2',
|
'django >= 1.4.2',
|
||||||
'django-model-utils<1.4',
|
'django-model-utils',
|
||||||
],
|
],
|
||||||
setup_requires=[
|
setup_requires=[
|
||||||
'django >= 1.4.2',
|
'django >= 1.4.2',
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
INSTALLED_APPS = ('django_journal', 'django.contrib.contenttypes' , 'django.contrib.auth', 'django.contrib.sessions', )
|
||||||
|
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3' }, }
|
||||||
|
SECRET_KEY = "django_tests_secret_key"
|
||||||
|
PASSWORD_HASHERS = ( 'django.contrib.auth.hashers.MD5PasswordHasher',)
|
||||||
|
ROOT_URLCONF = 'test_urls'
|
Loading…
Reference in New Issue