Spirit/runtests.py

40 lines
778 B
Python
Raw Normal View History

2014-11-20 22:43:38 +00:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
2014-11-20 22:43:38 +00:00
from __future__ import unicode_literals
2014-05-09 22:32:31 +00:00
import os
import sys
2014-11-20 18:16:49 +00:00
import logging
2014-05-09 22:32:31 +00:00
2014-11-26 04:29:16 +00:00
import django
from django.test.runner import DiscoverRunner
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.project.settings.test'
2014-05-09 22:32:31 +00:00
2014-11-20 18:16:49 +00:00
def log_warnings():
logger = logging.getLogger('py.warnings')
handler = logging.StreamHandler()
logger.addHandler(handler)
2014-05-09 22:32:31 +00:00
def run_tests():
sys.stdout.write(
"\nRunning spirit test suite, using settings %(settings)r\n\n" %
{"settings": os.environ['DJANGO_SETTINGS_MODULE']})
2014-05-09 22:32:31 +00:00
test_runner = DiscoverRunner()
2015-07-25 03:17:53 +00:00
failures = test_runner.run_tests([])
2014-05-09 22:32:31 +00:00
sys.exit(failures)
2014-11-20 18:43:54 +00:00
def start():
2014-09-29 01:22:00 +00:00
django.setup()
2014-11-20 18:16:49 +00:00
log_warnings()
2014-11-17 11:55:59 +00:00
run_tests()
2014-11-20 18:43:54 +00:00
if __name__ == "__main__":
2014-11-20 20:09:59 +00:00
start()