예제 #1
0
def stop(stream, packages, target, collect=False):
    '''Stop coverage'''
    # Call stop
    coverage.stop()
    # Collect if asked
    if collect: coverage.the_coverage.collect()
    # Get the file descriptor for the report
    fd = io.StringIO()
    # Get the report
    coverage.report(packages, file=fd)
    # Flush
    fd.flush()
    # Write on stream
    stream.write(fd.getvalue())
    # Write in target
    ntools.save(fd.getvalue(),
                os.path.join(target, 'coverage.dat'),
                binary=False)
    # Get the sources
    sources = parse(fd.getvalue())
    # Close the file descriptor
    fd.close()
    # Annotate source files
    annotate(packages, target, ignore_errors=True)
    # Create report
    report(target, sources)
예제 #2
0
파일: __init__.py 프로젝트: lhm-limux/gosa
def stop(stream, packages, target, collect=False):
    """Stop coverage"""
    # Call stop
    coverage.stop()
    # Collect if asked
    if collect:
        coverage.the_coverage.collect()
    # Get the file descriptor for the report
    fd = StringIO.StringIO()
    # Get the report
    coverage.report(packages, file=fd)
    # Flush
    fd.flush()
    # Write on stream
    stream.write(fd.getvalue())
    # Write in target
    ntools.save(fd.getvalue(), os.path.join(target, "coverage.dat"), binary=False)
    # Get the sources
    sources = parse(fd.getvalue())
    # Close the file descriptor
    fd.close()
    # Annotate source files
    annotate(packages, target, ignore_errors=True)
    # Create report
    report(target, sources)
예제 #3
0
 def test_sanity(self):
     content = """hello
     how are you ?
     """
     path = os.path.join(self.work, 'foo.dat')
     ntools.save(content, path)
     found = ntools.load(path)
     self.assertEqual(content, found)
예제 #4
0
 def test_sanity(self):
     content = """hello
     how are you ?
     """
     path = os.path.join(self.work, 'foo.dat')
     ntools.save(content, path)
     found = ntools.load(path)
     self.assertEquals(content, found)