Spirit/run_tests.py

34 lines
608 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
2014-05-09 19:32:31 -03:00
import os
import sys
2014-11-20 15:16:49 -03:00
import logging
2014-05-09 19:32:31 -03:00
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings_test_runner'
2014-09-28 22:22:00 -03:00
import django
2014-05-09 19:32:31 -03:00
from django.test.runner import DiscoverRunner
2014-11-20 15:16:49 -03:00
def log_warnings():
logger = logging.getLogger('py.warnings')
handler = logging.StreamHandler()
logger.addHandler(handler)
2014-05-09 19:32:31 -03:00
def run_tests():
test_runner = DiscoverRunner()
failures = test_runner.run_tests(["spirit", ])
sys.exit(failures)
2014-11-20 15:43:54 -03:00
def start():
2014-09-28 22:22:00 -03:00
django.setup()
2014-11-20 15:16:49 -03:00
log_warnings()
2014-11-17 12:55:59 +01:00
run_tests()
2014-11-20 15:43:54 -03:00
if __name__ == "__main__":
2014-11-20 17:09:59 -03:00
start()