<s> """<STR_LIT>""" <EOL> import logging <EOL> import warnings <EOL> from django . conf import settings <EOL> from django . test import TestCase <EOL> from django . test . simple import DjangoTestSuiteRunner , reorder_suite <EOL> from django . utils . importlib import import_module <EOL> from django . utils . unittest . loader import defaultTestLoader <EOL> from scielomanager . tools import get_setting_or_raise <EOL> DISABLE_LOGGING_BELOW_LEVEL = get_setting_or_raise ( '<STR_LIT>' ) <EOL> class DiscoveryRunner ( DjangoTestSuiteRunner ) : <EOL> def setup_test_environment ( self , ** kwargs ) : <EOL> if DISABLE_LOGGING_BELOW_LEVEL : <EOL> level = getattr ( logging , DISABLE_LOGGING_BELOW_LEVEL ) <EOL> logging . disable ( level ) <EOL> warnings . warn ( <EOL> "<STR_LIT>" % DISABLE_LOGGING_BELOW_LEVEL <EOL> ) <EOL> return super ( DiscoveryRunner , self ) . setup_test_environment ( ** kwargs ) <EOL> """<STR_LIT>""" <EOL> def build_suite ( self , test_labels , extra_tests = None , ** kwargs ) : <EOL> suite = None <EOL> discovery_root = settings . TEST_DISCOVERY_ROOT <EOL> if test_labels : <EOL> suite = defaultTestLoader . loadTestsFromNames ( test_labels ) <EOL> if not suite . countTestCases ( ) and len ( test_labels ) == <NUM_LIT:1> : <EOL> suite = None <EOL> discovery_root = import_module ( test_labels [ <NUM_LIT:0> ] ) . __path__ [ <NUM_LIT:0> ] <EOL> if suite is None : <EOL> suite = defaultTestLoader . discover ( <EOL> discovery_root , <EOL> top_level_dir = settings . BASE_PATH , <EOL> ) <EOL> if extra_tests : <EOL> for test in extra_tests : <EOL> suite . addTest ( test ) <EOL> return reorder_suite ( suite , ( TestCase , ) ) </s>
