mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-05-23 11:45:52 +00:00
Simple tests
This commit is contained in:
parent
1d0b1c3a43
commit
70f3fa45c1
4 changed files with 75 additions and 3 deletions
|
|
@ -4,9 +4,9 @@ python:
|
|||
- 3.5
|
||||
- "pypy"
|
||||
install:
|
||||
- pip install .
|
||||
- pip install -q Django==$DJANGO_VERSION
|
||||
- python setup.py -q install
|
||||
- python setup.py install
|
||||
env:
|
||||
- DJANGO_VERSION=1.7
|
||||
- DJANGO_VERSION=1.8
|
||||
script: python quicktest.py markdownx
|
||||
|
|
|
|||
65
quicktest.py
Normal file
65
quicktest.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
import os
|
||||
import sys
|
||||
import argparse
|
||||
from django.conf import settings
|
||||
|
||||
class QuickDjangoTest(object):
|
||||
"""
|
||||
A quick way to run the Django test suite without a fully-configured project.
|
||||
|
||||
Example usage:
|
||||
|
||||
>>> QuickDjangoTest('app1', 'app2')
|
||||
|
||||
Based on a script published by Lukasz Dziedzia at:
|
||||
http://stackoverflow.com/questions/3841725/how-to-launch-tests-for-django-reusable-app
|
||||
"""
|
||||
DIRNAME = os.path.dirname(__file__)
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.admin',
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.apps = args
|
||||
self.run_tests()
|
||||
|
||||
|
||||
def run_tests(self):
|
||||
settings.configure(
|
||||
DEBUG = False,
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(self.DIRNAME, 'database.db'),
|
||||
'USER': '',
|
||||
'PASSWORD': '',
|
||||
'HOST': '',
|
||||
'PORT': '',
|
||||
}
|
||||
},
|
||||
INSTALLED_APPS = self.INSTALLED_APPS + self.apps
|
||||
)
|
||||
from django.test.simple import DjangoTestSuiteRunner
|
||||
failures = DjangoTestSuiteRunner().run_tests(self.apps, verbosity=1, interactive=False)
|
||||
if failures:
|
||||
sys.exit(failures)
|
||||
|
||||
if __name__ == '__main__':
|
||||
"""
|
||||
What do when the user hits this file from the shell.
|
||||
|
||||
Example usage:
|
||||
|
||||
$ python quicktest.py app1 app2
|
||||
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
usage="[args]",
|
||||
description="Run Django tests on the provided applications."
|
||||
)
|
||||
parser.add_argument('apps', nargs='+', type=str)
|
||||
args = parser.parse_args()
|
||||
QuickDjangoTest(*args.apps)
|
||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Pillow
|
||||
Markdown
|
||||
7
setup.py
7
setup.py
|
|
@ -4,6 +4,11 @@ import os
|
|||
if 'vagrant' in str(os.environ):
|
||||
del os.link
|
||||
|
||||
|
||||
def get_requirements():
|
||||
return open('requirements.txt').read().splitlines()
|
||||
|
||||
|
||||
setup(
|
||||
name='django-markdownx',
|
||||
version='1.0.1',
|
||||
|
|
@ -27,5 +32,5 @@ setup(
|
|||
'Programming Language :: JavaScript',
|
||||
],
|
||||
keywords='django markdown live preview images upload',
|
||||
install_requires=['Pillow', 'Markdown'],
|
||||
install_requires=get_requirements(),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue