当前位置: 首页>>代码示例>>Python>>正文


Python RunApp.RunApp类代码示例

本文整理汇总了Python中RunApp.RunApp的典型用法代码示例。如果您正苦于以下问题:Python RunApp类的具体用法?Python RunApp怎么用?Python RunApp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RunApp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: processResults

    def processResults(self, moose_dir, options, output):
        reason = ''
        specs = self.specs

        if self.hasRedirectedOutput(options):
            redirected_output = util.getOutputFromFiles(self, options)
            output += redirected_output

        # Expected errors and assertions might do a lot of things including crash so we
        # will handle them seperately
        if specs.isValid('expect_err'):
            if not util.checkOutputForPattern(output, specs['expect_err']):
                reason = 'EXPECTED ERROR MISSING'
        elif specs.isValid('expect_assert'):
            if options.method in ['dbg', 'devel']:  # Only check asserts in debug and devel modes
                if not util.checkOutputForPattern(output, specs['expect_assert']):
                    reason = 'EXPECTED ASSERT MISSING'

        # If we've set a reason right here, we should report the pattern that we were unable to match.
        if reason != '':
            output += "#"*80 + "\n\nUnable to match the following pattern against the program's output:\n\n" + specs['expect_err'] + "\n"

        if reason == '':
            RunApp.testFileOutput(self, moose_dir, options, output)

        if reason != '':
            self.setStatus(reason, self.bucket_fail)
        else:
            self.setStatus(self.success_message, self.bucket_success)

        return output
开发者ID:zachmprince,项目名称:moose,代码行数:31,代码来源:RunException.py

示例2: processResults

    def processResults(self, moose_dir, options, output):
        reason = ''
        specs = self.specs

        if self.hasRedirectedOutput(options):
            redirected_output = util.getOutputFromFiles(self, options)
            output += redirected_output

        # Expected errors and assertions might do a lot of things including crash so we
        # will handle them seperately
        if specs.isValid('expect_err'):
            if not util.checkOutputForPattern(output, specs['expect_err']):
                reason = 'NO EXPECTED ERR'
        elif specs.isValid('expect_assert'):
            if options.method == 'dbg':  # Only check asserts in debug mode
                if not util.checkOutputForPattern(output, specs['expect_assert']):
                    reason = 'NO EXPECTED ASSERT'

        if reason == '':
            RunApp.testFileOutput(self, moose_dir, options, output)

        if reason != '':
            self.setStatus(reason, self.bucket_fail)
        else:
            self.setStatus(self.success_message, self.bucket_success)

        return output
开发者ID:aeslaughter,项目名称:moose,代码行数:27,代码来源:RunException.py

示例3: processResults

    def processResults(self, moose_dir, options, output):
        RunApp.testFileOutput(self, moose_dir, options, output)

        # Skip
        specs = self.specs

        if self.getStatus() == self.bucket_fail or specs['skip_checks']:
            return output

        # Don't Run VTKDiff on Scaled Tests
        if options.scaling and specs['scale_refine']:
            return output

        # Loop over every file
        for file in specs['vtkdiff']:

            # Error if gold file does not exist
            if not os.path.exists(os.path.join(specs['test_dir'], specs['gold_dir'], file)):
                output += "File Not Found: " + os.path.join(specs['test_dir'], specs['gold_dir'], file)
                self.setStatus('MISSING GOLD FILE', self.bucket_fail)
                break

            # Perform diff
            else:
                for file in self.specs['vtkdiff']:
                    gold = os.path.join(specs['test_dir'], specs['gold_dir'], file)
                    test = os.path.join(specs['test_dir'], file)

                    # We always ignore the header_type attribute, since it was
                    # introduced in VTK 7 and doesn't seem to be important as
                    # far as Paraview is concerned.
                    specs['ignored_attributes'].append('header_type')

                    differ = XMLDiffer(gold, test, abs_zero=specs['abs_zero'], rel_tol=specs['rel_err'], ignored_attributes=specs['ignored_attributes'])

                    # Print the results of the VTKDiff whether it passed or failed.
                    output += differ.message() + '\n'

                    if differ.fail():
                        self.addCaveats('VTKDIFF')
                        self.setStatus(self.bucket_skip.status, self.bucket_skip)
                        break

        # If status is still pending, then it is a passing test
        if self.getStatus() == self.bucket_pending:
            self.setStatus(self.success_message, self.bucket_success)

        return output
开发者ID:zachmprince,项目名称:moose,代码行数:48,代码来源:VTKDiff.py

示例4: processResults

  def processResults(self, moose_dir, retcode, options, output):
    (reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)

    specs = self.specs
    if reason != '' or specs['skip_checks']:
      return (reason, output)

    if reason == '':
     # if still no errors, check other files (just for existence)
     for file in self.specs['check_files']:
       if not os.path.isfile(os.path.join(self.specs['test_dir'], file)):
         reason = 'MISSING FILES'
         break
     for file in self.specs['check_not_exists']:
       if os.path.isfile(os.path.join(self.specs['test_dir'], file)):
         reason = 'UNEXPECTED FILES'
         break

     # if still no errors, check that all the files contain the file_expect_out expression
     if reason == '':
       if self.specs.isValid('file_expect_out'):
         for file in self.specs['check_files']:
           fid = open(os.path.join(self.specs['test_dir'], file), 'r')
           contents = fid.read()
           fid.close()
           if not self.checkOutputForPattern(contents, self.specs['file_expect_out']):
             reason = 'NO EXPECTED OUT IN FILE'
             break

    return (reason, output)
开发者ID:Jieun2,项目名称:moose,代码行数:30,代码来源:CheckFiles.py

示例5: getValidParams

 def getValidParams():
   params = RunApp.getValidParams()
   params.addParam('check_files', [], "A list of files that MUST exist.")
   params.addParam('check_not_exists', [], "A list of files that must NOT exist.")
   params.addParam('delete_output_before_running',  True, "Delete pre-existing output files before running test. Only set to False if you know what you're doing!")
   params.addParam('file_expect_out', "A regular expression that must occur in all of the check files in order for the test to be considered passing.")
   return params
开发者ID:Jieun2,项目名称:moose,代码行数:7,代码来源:CheckFiles.py

示例6: processResults

  def processResults(self, moose_dir, retcode, options, output):
    (reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)

    if reason != '' or self.specs['skip_checks']:
      return (reason, output)

    # Don't Run Exodiff on Scaled Tests
    if options.scaling and self.specs['scale_refine']:
      return (reason, output)

    # Make sure that all of the Exodiff files are actually available
    for file in self.specs['txtdiff']:
      if not os.path.exists(os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)):
        output += "File Not Found: " + os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)
        reason = 'MISSING GOLD FILE'
        break

    # Run the txtdiff
    if reason == '':
      output += 'Running txtdiff'
      with open(os.path.join(self.specs['test_dir'], file), 'r') as f:
        first_line = f.readline()
      with open(os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file), 'r') as f:
        first_line_gold = f.readline()
      if first_line != first_line_gold:
        reason = 'TXTDIFF'

    return (reason, output)
开发者ID:brianmoose,项目名称:redback,代码行数:28,代码来源:Txtdiff.py

示例7: validParams

  def validParams():
    params = RunApp.validParams()
    params.addRequiredParam('txtdiff',   [], "A list of files to txtdiff.")
    params.addParam('gold_dir',      'gold', "The directory where the \"golden standard\" files reside relative to the TEST_DIR: (default: ./gold/)")
    params.addParam('delete_output_before_running',  True, "Delete pre-existing output files before running test. Only set to False if you know what you're doing!")

    return params
开发者ID:brianmoose,项目名称:redback,代码行数:7,代码来源:Txtdiff.py

示例8: processResults

 def processResults(self, moose_dir, retcode, options, output):
   if self.httpServer.getNumberOfPosts() != int(self.nPosts):
      return ("ICEUpdater FAILED: DID NOT GET CORRECT NUMBER OF POSTS",
              "Number of Posts was " + str(self.httpServer.getNumberOfPosts()) +
              ", but should have been " + str(self.nPosts))
   else:
      return RunApp.processResults(self, moose_dir, retcode, options, output)
开发者ID:cbolisetti,项目名称:moose,代码行数:7,代码来源:ICEUpdaterTester.py

示例9: processResults

  def processResults(self, moose_dir, retcode, options, output):
    (reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)

    if reason != '' or self.specs['skip_checks']:
      return (reason, output)

    # Don't Run Exodiff on Scaled Tests
    if options.scaling and self.specs['scale_refine']:
      return (reason, output)

    # Make sure that all of the Exodiff files are actually available
    for file in self.specs['exodiff']:
      if not os.path.exists(os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)):
        output += "File Not Found: " + os.path.join(self.specs['test_dir'], self.specs['gold_dir'], file)
        reason = 'MISSING GOLD FILE'
        break

    if reason == '':
      # Retrieve the commands
      commands = self.processResultsCommand(moose_dir, options)

      for command in commands:
        exo_output = runCommand(command)

        output += 'Running exodiff: ' + command + '\n' + exo_output + ' ' + ' '.join(self.specs['exodiff_opts'])

        if ('different' in exo_output or 'ERROR' in exo_output) and not "Files are the same" in exo_output:
          reason = 'EXODIFF'
          break

    return (reason, output)
开发者ID:JasonTurner56,项目名称:ARL,代码行数:31,代码来源:Exodiff.py

示例10: processResults

  def processResults(self, moose_dir, retcode, options, output):
    (reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)

    specs = self.specs
    if reason != '' or specs['skip_checks']:
      return (reason, output)

    # Don't Run Exodiff on Scaled Tests
    if options.scaling and specs['scale_refine']:
      return (reason, output)

    for file in specs['exodiff']:
      custom_cmp = ''
      old_floor = ''
      if specs.isValid('custom_cmp'):
         custom_cmp = ' -f ' + os.path.join(specs['test_dir'], specs['custom_cmp'])
      if specs['use_old_floor']:
         old_floor = ' -use_old_floor'

      if not os.path.exists(os.path.join(specs['test_dir'], specs['gold_dir'], file)):
        output += "File Not Found: " + os.path.join(specs['test_dir'], specs['gold_dir'], file)
        reason = 'MISSING GOLD FILE'
        break
      else:
        command = os.path.join(moose_dir, 'framework', 'contrib', 'exodiff', 'exodiff') + ' -m' + custom_cmp + ' -F' + ' ' + str(specs['abs_zero']) + old_floor + ' -t ' + str(specs['rel_err']) \
            + ' ' + ' '.join(specs['exodiff_opts']) + ' ' + os.path.join(specs['test_dir'], specs['gold_dir'], file) + ' ' + os.path.join(specs['test_dir'], file)
        exo_output = runCommand(command)

        output += 'Running exodiff: ' + command + '\n' + exo_output + ' ' + ' '.join(specs['exodiff_opts'])

        if ('different' in exo_output or 'ERROR' in exo_output) and not "Files are the same" in exo_output:
          reason = 'EXODIFF'
          break

    return (reason, output)
开发者ID:DarinReid,项目名称:moose,代码行数:35,代码来源:Exodiff.py

示例11: processResults

    def processResults(self, moose_dir, retcode, options, output):
        (reason, output) = RunApp.processResults(self, moose_dir, retcode, options, output)

        specs = self.specs
        if reason != "" or specs["skip_checks"]:
            return (reason, output)

        if reason == "":
            # if still no errors, check other files (just for existence)
            for file in self.specs["check_files"]:
                if not os.path.isfile(os.path.join(self.specs["test_dir"], file)):
                    reason = "MISSING FILES"
                    break
            for file in self.specs["check_not_exists"]:
                if os.path.isfile(os.path.join(self.specs["test_dir"], file)):
                    reason = "UNEXPECTED FILES"
                    break

            # if still no errors, check that all the files contain the file_expect_out expression
            if reason == "":
                if self.specs.isValid("file_expect_out"):
                    for file in self.specs["check_files"]:
                        fid = open(os.path.join(self.specs["test_dir"], file), "r")
                        contents = fid.read()
                        fid.close()
                        if not self.checkOutputForPattern(contents, self.specs["file_expect_out"]):
                            reason = "NO EXPECTED OUT IN FILE"
                            break

        return (reason, output)
开发者ID:permcody,项目名称:moose,代码行数:30,代码来源:CheckFiles.py

示例12: validParams

 def validParams():
     params = RunApp.validParams()
     params.addParam('ratio_tol', 1e-8, "Relative tolerance to compare the ration against.")
     params.addParam('difference_tol', 1e-8, "Relative tolerance to compare the difference against.")
     params.addParam('state', 'user', "The state for which we want to compare against the "
                                      "finite-differenced Jacobian ('user', 'const_positive', or "
                                      "'const_negative'.")
     return params
开发者ID:zachmprince,项目名称:moose,代码行数:8,代码来源:PetscJacobianTester.py

示例13: validParams

  def validParams():
    params = RunApp.validParams()

    params.addParam('expect_err', "A regular expression that must occur in the ouput. (Test may terminiate unexpectedly and be considered passing)")
    params.addParam('expect_assert', "DEBUG MODE ONLY: A regular expression that must occur in the ouput. (Test may terminiate unexpectedly and be considered passing)")
    params.addParam('should_crash', True, "Inidicates that the test is expected to crash or otherwise terminate early")

    return params
开发者ID:IoannisSt,项目名称:moose,代码行数:8,代码来源:RunException.py

示例14: validParams

    def validParams():
        params = RunApp.validParams()
        params.addRequiredParam('vtkdiff',   [], "A list of files to exodiff.")
        params.addParam('gold_dir',      'gold', "The directory where the \"golden standard\" files reside relative to the TEST_DIR: (default: ./gold/)")
        params.addParam('abs_zero',       1e-10, "Absolute zero cutoff used in exodiff comparisons.")
        params.addParam('rel_err',       5.5e-6, "Relative error value used in exodiff comparisons.")
        params.addParam('ignored_attributes',  [], "Ignore e.g. type and/or version in sample XML block <VTKFile type=\"Foo\" version=\"0.1\">")

        return params
开发者ID:aeslaughter,项目名称:moose,代码行数:9,代码来源:VTKDiff.py

示例15: getValidParams

  def getValidParams():
    params = RunApp.getValidParams()
    params.addRequiredParam('vtkdiff',   [], "A list of files to exodiff.")
    params.addParam('gold_dir',      'gold', "The directory where the \"golden standard\" files reside relative to the TEST_DIR: (default: ./gold/)")
    params.addParam('abs_zero',       1e-10, "Absolute zero cutoff used in exodiff comparisons.")
    params.addParam('rel_err',       5.5e-6, "Relative error value used in exodiff comparisons.")
    params.addParam('delete_output_before_running',  True, "Delete pre-existing output files before running test. Only set to False if you know what you're doing!")

    return params
开发者ID:Jieun2,项目名称:moose,代码行数:9,代码来源:VTKDiff.py


注:本文中的RunApp.RunApp类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。