tools/traffic_annotation/scripts/traffic_annotation_auditor_tests.py
def _RunTest(self, args, use_python_auditor):
    """Runs the auditor test with given |args|, and returns the extracted
    annotations.

    Args:
      args: list of str Arguments to be passed to auditor.
      use_python_auditor: If True, test auditor.py instead of
        traffic_annotation_auditor.exe.

    Returns:
      str Content of annotations.tsv file if successful, otherwise None.
    """

    if use_python_auditor:
      auditor_name = "auditor.py"
    else:
      auditor_name = "traffic_annotation_auditor"
    print("Running %s using config: %s" % (auditor_name, args))

    try:
      os.remove(self.annotations_filename)
    except OSError:
      pass

    stdout_text, stderr_text, return_code = self.tools.RunAuditor(
        args + ["--annotations-file=%s" % self.annotations_filename],
        use_python_auditor)

    annotations = None
    if os.path.exists(self.annotations_filename):
      # When tests are run on all files (without filtering), there might be some
      # compile errors in irrelevant files on Windows that can be ignored.
      if (return_code and "--no-filtering" in args and
          sys.platform.startswith(('win', 'cygwin'))):
        print("Ignoring return code: %i" % return_code)
        return_code = 0
      if not return_code:
        annotations = open(self.annotations_filename).read()
      if not self.persist_annotations:
        os.remove(self.annotations_filename)

    if annotations:
      print("Test PASSED.")
    else:
      print("Test FAILED.")

    if stdout_text:
      print(stdout_text)
    if stderr_text:
      print(stderr_text)

    return annotations
Runs the auditor test with given |args|, and returns the extracted
    annotations.

    Args:
      args: list of str Arguments to be passed to auditor.
      use_python_auditor: If True, test auditor.py instead of
        traffic_annotation_auditor.exe.

    Returns:
      str Content of annotations.tsv file if successful, otherwise None.
    
Runs the auditor test with given |args|, and returns the extracted
annotations.
Runs the auditor test with given |args| and returns the extracted annotations .
def _RunTest(self, args, use_python_auditor):
    if use_python_auditor:
      auditor_name = "auditor.py"
    else:
      auditor_name = "traffic_annotation_auditor"
    print("Running %s using config: %s" % (auditor_name, args))
    try:
      os.remove(self.annotations_filename)
    except OSError:
      pass
    stdout_text, stderr_text, return_code = self.tools.RunAuditor(
        args + ["--annotations-file=%s" % self.annotations_filename],
        use_python_auditor)
    annotations = None
    if os.path.exists(self.annotations_filename):
      if (return_code and "--no-filtering" in args and
          sys.platform.startswith(('win', 'cygwin'))):
        print("Ignoring return code: %i" % return_code)
        return_code = 0
      if not return_code:
        annotations = open(self.annotations_filename).read()
      if not self.persist_annotations:
        os.remove(self.annotations_filename)
    if annotations:
      print("Test PASSED.")
    else:
      print("Test FAILED.")
    if stdout_text:
      print(stdout_text)
    if stderr_text:
      print(stderr_text)
    return annotations
def _RunTest ( self , args , use_python_auditor ) : if use_python_auditor : auditor_name = "auditor.py" else : auditor_name = "traffic_annotation_auditor" print ( "Running %s using config: %s" % ( auditor_name , args ) ) try : os . remove ( self . annotations_filename ) except OSError : pass stdout_text , stderr_text , return_code = self . tools . RunAuditor ( args + [ "--annotations-file=%s" % self . annotations_filename ] , use_python_auditor ) annotations = None if os . path . exists ( self . annotations_filename ) : if ( return_code and "--no-filtering" in args and sys . platform . startswith ( ( 'win' , 'cygwin' ) ) ) : print ( "Ignoring return code: %i" % return_code ) return_code = 0 if not return_code : annotations = open ( self . annotations_filename ) . read ( ) if not self . persist_annotations : os . remove ( self . annotations_filename ) if annotations : print ( "Test PASSED." ) else : print ( "Test FAILED." ) if stdout_text : print ( stdout_text ) if stderr_text : print ( stderr_text ) return annotations
Runs the auditor test with given |args|, and returns the extracted
annotations.
Runs the auditor test with given |args| and returns the extracted annotations .
"""Runs the auditor test with given |args|, and returns the extracted
    annotations.

    Args:
      args: list of str Arguments to be passed to auditor.
      use_python_auditor: If True, test auditor.py instead of
        traffic_annotation_auditor.exe.

    Returns:
      str Content of annotations.tsv file if successful, otherwise None.
    """ # When tests are run on all files (without filtering), there might be some # compile errors in irrelevant files on Windows that can be ignored.
str Content of annotations.tsv file if successful, otherwise None.
str Content of annotations . tsv file if successful otherwise None .
self
args
list of str Arguments to be passed to auditor.
list of str Arguments to be passed to auditor .
use_python_auditor
If True, test auditor.py instead of
traffic_annotation_auditor.exe.
If True test auditor . py instead of traffic_annotation_auditor . exe .