且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python中的硒单元测试-我的日志文件在哪里?

更新时间:2023-11-16 22:27:52

在单元测试脚本中,放置

In your unit test script, place

import logging
logging.basicConfig(filename = log_filename, level = logging.DEBUG)

其中log_filename是您想要将日志文件写入的位置的路径.

where log_filename is a path to wherever you'd like the log file written to.

如果没有调用logging.basicConfig或进行类似的调用来设置日志记录处理程序,则LOGGER.debug命令将不执行任何操作.

Without the call to logging.basicConfig or some such call to setup a logging handler, the LOGGER.debug command does nothing.