Ejemplo n.º 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)
Ejemplo n.º 2
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 = 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)
Ejemplo n.º 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)
Ejemplo n.º 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)