<s> '''<STR_LIT>''' <EOL> import sublime <EOL> import sublime_plugin <EOL> import os <EOL> def find_project_path ( path ) : <EOL> while True : <EOL> if not path or os . path . exists ( os . path . join ( path , <EOL> '<STR_LIT>' ) ) : <EOL> return path <EOL> path = os . path . dirname ( path ) <EOL> class RunTestsForActiveViewCommand ( sublime_plugin . WindowCommand ) : <EOL> '''<STR_LIT>''' <EOL> def run ( self , ** kwargs ) : <EOL> v = self . window . active_view ( ) <EOL> if v is None : <EOL> return <EOL> proj_path = find_project_path ( v . file_name ( ) ) <EOL> if not proj_path or not v . file_name ( ) . endswith ( '<STR_LIT>' ) : <EOL> print ( '<STR_LIT>' ) <EOL> return <EOL> if os . path . basename ( v . file_name ( ) ) . startswith ( '<STR_LIT>' ) : <EOL> self . window . run_command ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : proj_path <EOL> } ) <EOL> return <EOL> tail = os . path . join ( '<STR_LIT>' , v . file_name ( ) [ len ( proj_path ) + <NUM_LIT:1> : ] ) <EOL> full = os . path . join ( proj_path , os . path . dirname ( tail ) , <EOL> '<STR_LIT>' + os . path . basename ( tail ) ) <EOL> if os . path . exists ( full ) : <EOL> self . window . run_command ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : os . path . basename ( full ) , <EOL> '<STR_LIT>' : proj_path <EOL> } ) <EOL> return <EOL> self . window . run_command ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : proj_path <EOL> } ) <EOL> class RunAllTestsCommand ( sublime_plugin . WindowCommand ) : <EOL> '''<STR_LIT>''' <EOL> def run ( self ) : <EOL> v = self . window . active_view ( ) <EOL> if v is None : <EOL> return <EOL> self . window . run_command ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : find_project_path ( v . file_name ( ) ) <EOL> } ) </s>
