<s> web2py_environment = dict ( globals ( ) ) <EOL> __doc__ = """<STR_LIT>""" <EOL> import sys <EOL> from types import ModuleType <EOL> import nose <EOL> import glob <EOL> import os . path <EOL> import os <EOL> import copy <EOL> from gluon . globals import Request <EOL> import unittest <EOL> def load_module ( application_relative_module_path ) : <EOL> import os <EOL> web2py_relative_module_path = "<STR_LIT:.>" . join ( ( <EOL> "<STR_LIT>" , request . application , application_relative_module_path <EOL> ) ) <EOL> imported_module = __import__ ( web2py_relative_module_path ) <EOL> for step in web2py_relative_module_path . split ( "<STR_LIT:.>" ) [ <NUM_LIT:1> : ] : <EOL> imported_module = getattr ( imported_module , step ) <EOL> return imported_module <EOL> web2py_environment [ "<STR_LIT>" ] = load_module <EOL> web2py_env_module = ModuleType ( "<STR_LIT>" ) <EOL> web2py_env_module . __dict__ . update ( web2py_environment ) <EOL> sys . modules [ "<STR_LIT>" ] = web2py_env_module <EOL> application_name = request . application <EOL> application_folder_path = os . path . join ( "<STR_LIT>" , application_name ) <EOL> application = application_name <EOL> controller = "<STR_LIT>" <EOL> function = "<STR_LIT>" <EOL> folder = os . path . join ( os . getcwd ( ) , "<STR_LIT>" , application_name ) <EOL> web2py_environment [ "<STR_LIT>" ] = Request <EOL> request = Request ( ) <EOL> request . application = application <EOL> request . controller = controller <EOL> request . function = function <EOL> request . folder = folder <EOL> web2py_environment [ "<STR_LIT>" ] = request <EOL> current . request = request <EOL> controller_configuration = OrderedDict ( ) <EOL> for controller_name in [ "<STR_LIT:default>" ] + glob . glob ( <EOL> os . path . join ( application_folder_path , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ) : <EOL> controller_configuration [ controller_name ] = Storage ( <EOL> name_nice = controller_name , <EOL> description = controller_name , <EOL> restricted = False , <EOL> module_type = <NUM_LIT:0> <EOL> ) <EOL> current . deployment_settings . modules = controller_configuration <EOL> test_folders = set ( ) <EOL> argv = [ ] <EOL> test_root = os . path . join ( application_folder_path , "<STR_LIT>" , "<STR_LIT>" ) <EOL> current_working_directory = os . getcwd ( ) <EOL> disallowed_options = { } <EOL> disallowed_options [ "<STR_LIT>" ] = disallowed_options [ "<STR_LIT>" ] = ( <EOL> "<STR_LIT>" <EOL> ) <EOL> for arg in sys . argv [ <NUM_LIT:1> : ] : <EOL> if arg . startswith ( "<STR_LIT:->" ) : <EOL> if not arg . startswith ( "<STR_LIT>" ) : <EOL> print ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> else : <EOL> try : <EOL> reason = disallowed_options [ arg ] <EOL> except KeyError : <EOL> pass <EOL> else : <EOL> print "<STR_LIT>" % ( arg , reason ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> argv . append ( arg ) <EOL> else : <EOL> test_path = arg <EOL> test_folder_fuller_path = os . path . join ( test_root , test_path ) <EOL> test_folders . add ( test_folder_fuller_path ) <EOL> if not os . path . exists ( test_folder_fuller_path ) : <EOL> print "<STR_LIT:\n>" , test_folder_fuller_path , "<STR_LIT>" <EOL> argv . append ( test_root ) <EOL> if len ( test_folders ) == <NUM_LIT:0> : <EOL> test_folders . add ( test_root ) <EOL> sys . argv [ <NUM_LIT:1> : ] = argv <EOL> test_utils = local_import ( "<STR_LIT>" ) <EOL> nose . main ( <EOL> addplugins = nose . plugins . PluginManager ( [ <EOL> test_utils . Web2pyNosePlugin ( <EOL> application_name , <EOL> web2py_environment , <EOL> re . compile ( <EOL> re . escape ( os . path . sep ) . join ( <EOL> ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> application_name + "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" <EOL> ) <EOL> ) <EOL> ) , <EOL> test_folders <EOL> ) <EOL> ] ) <EOL> ) </s>
