original_docstring: Create and build projects from project_templates.
docstring: Create and build projects from project_templates.
docstring_tokens: Create and build projects from project_templates .
code: def testProjectTemplates(self):
        '''Create and build projects from project_templates.'''
  
        def initAndCompileProject(project_name, flags=[]):
          '''A small helper function that runs init_project.py and then runs
          a scons build in the resulting directory.
  
          Args:
            project_name: The project's name, set the --name= parameter for
                init_project to this value.
            flags: Any extra flags to pass to init_project.  Must be an array,
                can be empty.
          '''
          path = os.path.join(_outdir, 'project_templates')
          project_path = os.path.join(_outdir, project_name)
          scons_command = self.SconsCommand(project_path)
          init_project_command = [sys.executable,
                                  'init_project.py',
                                  '--name=%s' % project_name,
                                  '--nacl-platform=.'] + flags
          env = self.GetBotShellEnv()
          annotator.Run(init_project_command, cwd=path, env=env)
          annotator.Run(scons_command, cwd=project_path, env=env)
  
        initAndCompileProject('test_c_project', flags=['-c'])
        initAndCompileProject('test_cc_project')
        # Calling init_project again with the same names should cause an error
        # because the project already exists, and we don't overwrite projects.
        print "Rerunning init_project again to test overwriting previous project."
        print "We expect these tests to throw exceptions:"
        self.assertRaises(subprocess.CalledProcessError,
                          initAndCompileProject,
                          'test_c_project',
                          flags=['-c'])
        self.assertRaises(subprocess.CalledProcessError,
                          initAndCompileProject,
                          'test_cc_project')
code_tokens: def testProjectTemplates ( self ) : def initAndCompileProject ( project_name , flags = [ ] ) : '''A small helper function that runs init_project.py and then runs
          a scons build in the resulting directory.
  
          Args:
            project_name: The project's name, set the --name= parameter for
                init_project to this value.
            flags: Any extra flags to pass to init_project.  Must be an array,
                can be empty.
          ''' path = os . path . join ( _outdir , 'project_templates' ) project_path = os . path . join ( _outdir , project_name ) scons_command = self . SconsCommand ( project_path ) init_project_command = [ sys . executable , 'init_project.py' , '--name=%s' % project_name , '--nacl-platform=.' ] + flags env = self . GetBotShellEnv ( ) annotator . Run ( init_project_command , cwd = path , env = env ) annotator . Run ( scons_command , cwd = project_path , env = env ) initAndCompileProject ( 'test_c_project' , flags = [ '-c' ] ) initAndCompileProject ( 'test_cc_project' ) print "Rerunning init_project again to test overwriting previous project." print "We expect these tests to throw exceptions:" self . assertRaises ( subprocess . CalledProcessError , initAndCompileProject , 'test_c_project' , flags = [ '-c' ] ) self . assertRaises ( subprocess . CalledProcessError , initAndCompileProject , 'test_cc_project' )
short_docstring: Create and build projects from project_templates.
short_docstring_tokens: Create and build projects from project_templates .
comment: '''Create and build projects from project_templates.'''$SEP$'''A small helper function that runs init_project.py and then runs
          a scons build in the resulting directory.
  
          Args:
            project_name: The project's name, set the --name= parameter for
                init_project to this value.
            flags: Any extra flags to pass to init_project.  Must be an array,
                can be empty.
          '''$SEP$# Calling init_project again with the same names should cause an error$SEP$# because the project already exists, and we don't overwrite projects.