def report(self) -> t.Optional[str]:
"""
Create an report and output it as configured.
:param with_tester_results: include the hypothesis tester results
:param to_string: return the report as a string and don't output it?
:return: the report string if ``to_string == True``
"""
if not self.misc["out"] == "-" and not os.path.exists(os.path.dirname(self.misc["out"])):
logging.error("Folder for report ({}) doesn't exist".format(os.path.dirname(self.misc["out"])))
exit(1)
with click.open_file(self.misc["out"], mode='w') as f:
import tablib
data = tablib.Dataset(self.misc["columns"])
for row in self._table():
data.append(row)
f.write(data.csv)
评论列表
文章目录