<s> from django . conf import settings <EOL> from django . test import TestCase <EOL> from django . test . simple import ( setup_test_environment , reorder_suite , <EOL> build_test , build_suite , get_app , get_apps , <EOL> teardown_test_environment ) <EOL> import unittest <EOL> def run_tests ( test_labels , verbosity = <NUM_LIT:1> , interactive = True , extra_tests = [ ] ) : <EOL> """<STR_LIT>""" <EOL> setup_test_environment ( ) <EOL> settings . DEBUG = False <EOL> settings . DATABASE_SUPPORTS_TRANSACTIONS = False <EOL> suite = unittest . TestSuite ( ) <EOL> if test_labels : <EOL> for label in test_labels : <EOL> if '<STR_LIT:.>' in label : <EOL> suite . addTest ( build_test ( label ) ) <EOL> else : <EOL> app = get_app ( label ) <EOL> suite . addTest ( build_suite ( app ) ) <EOL> else : <EOL> for app in get_apps ( ) : <EOL> suite . addTest ( build_suite ( app ) ) <EOL> for test in extra_tests : <EOL> suite . addTest ( test ) <EOL> suite = reorder_suite ( suite , ( TestCase , ) ) <EOL> runner = unittest . TextTestRunner ( verbosity = verbosity ) <EOL> result = runner . run ( suite ) <EOL> teardown_test_environment ( ) <EOL> return len ( result . failures ) + len ( result . errors ) </s>
