def finalize(self, result): """ Finalize: stop recording coverage info, save & exit. """ figleaf.stop() fp = open(self.figleaf_file, 'w') figleaf.dump_pickled_coverage(fp) fp.close()
def pytest_sessionfinish(session, exitstatus): # pylint: disable=W0613 """ Write out figleaf coverage report for the test session. """ figleaf.stop() filepath_coverage_log = session.config.known_args_namespace.coverage_log with open(filepath_coverage_log, 'wb') as file: figleaf.dump_pickled_coverage(file)
import figleaf figleaf.start() def a(): print 'this is a' def b(): print 'this is b' def c(): print 'this is c' figleaf.start_section('foo') a() figleaf.start_section('bar') b() figleaf.stop_section() c() figleaf.stop() figleaf.dump_pickled_coverage(open('.figleaf_sections', 'wb'))