mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-12 18:00:45 +01:00
tests are correctly discovered for django < 1.6
This commit is contained in:
parent
50877c3708
commit
cd0daccb56
@ -1,6 +1,9 @@
|
||||
from os.path import dirname, basename, isfile
|
||||
import glob
|
||||
# import all test_*.py files in directory.
|
||||
# neccessary for automatic discovery in django <= 1.5
|
||||
# http://stackoverflow.com/a/15780326/1382740
|
||||
|
||||
# import all test_*.py files in directory
|
||||
modules = glob.glob(dirname(__file__)+"/test_*.py")
|
||||
__all__ = [basename(f)[:-3] for f in modules if isfile(f)]
|
||||
import unittest
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().discover("helpdesk.tests", pattern="test_*.py")
|
||||
|
10
quicktest.py
10
quicktest.py
@ -97,13 +97,13 @@ class QuickDjangoTest(object):
|
||||
# see: http://stackoverflow.com/questions/3841725/how-to-launch-tests-for-django-reusable-app
|
||||
|
||||
try:
|
||||
# Django <= 1.8
|
||||
from django.test.simple import DjangoTestSuiteRunner
|
||||
test_runner = DjangoTestSuiteRunner(verbosity=1)
|
||||
except ImportError:
|
||||
# Django >= 1.8
|
||||
# Django >= 1.6
|
||||
from django.test.runner import DiscoverRunner
|
||||
test_runner = DiscoverRunner(verbosity=1)
|
||||
except ImportError:
|
||||
# Django <= 1.5
|
||||
from django.test.simple import DjangoTestSuiteRunner
|
||||
test_runner = DjangoTestSuiteRunner(verbosity=1)
|
||||
|
||||
if django.VERSION >= (1, 7):
|
||||
django.setup()
|
||||
|
Loading…
Reference in New Issue
Block a user