mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-12 18:00:45 +01:00
Allow the running of individually specified tests
This commit is contained in:
parent
f3ffebc261
commit
38dae04346
17
quicktest.py
17
quicktest.py
@ -27,7 +27,8 @@ class QuickDjangoTest(object):
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.staticfiles',
|
||||
'bootstrap4form'
|
||||
'bootstrap4form',
|
||||
'helpdesk',
|
||||
)
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
@ -62,7 +63,7 @@ class QuickDjangoTest(object):
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.apps = args
|
||||
self.tests = args
|
||||
self._tests()
|
||||
|
||||
def _tests(self):
|
||||
@ -79,7 +80,7 @@ class QuickDjangoTest(object):
|
||||
'PORT': '',
|
||||
}
|
||||
},
|
||||
INSTALLED_APPS=self.INSTALLED_APPS + self.apps,
|
||||
INSTALLED_APPS=self.INSTALLED_APPS,
|
||||
MIDDLEWARE=self.MIDDLEWARE,
|
||||
ROOT_URLCONF='helpdesk.tests.urls',
|
||||
STATIC_URL='/static/',
|
||||
@ -92,7 +93,7 @@ class QuickDjangoTest(object):
|
||||
test_runner = DiscoverRunner(verbosity=1)
|
||||
django.setup()
|
||||
|
||||
failures = test_runner.run_tests(self.apps)
|
||||
failures = test_runner.run_tests(self.tests)
|
||||
if failures:
|
||||
sys.exit(failures)
|
||||
|
||||
@ -102,13 +103,13 @@ if __name__ == '__main__':
|
||||
|
||||
Example usage:
|
||||
|
||||
$ python quicktest.py app1 app2
|
||||
$ python quicktest.py test1 test2
|
||||
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
usage="[args]",
|
||||
description="Run Django tests on the provided applications."
|
||||
description="Run Django tests."
|
||||
)
|
||||
parser.add_argument('apps', nargs='+', type=str)
|
||||
parser.add_argument('tests', nargs='+', type=str)
|
||||
args = parser.parse_args()
|
||||
QuickDjangoTest(*args.apps)
|
||||
QuickDjangoTest(*args.tests)
|
||||
|
Loading…
Reference in New Issue
Block a user