我在 中有以下代码conftest.py
。它将所有测试的结果存储到同一个文件中。我想将日志存储在文件名为 的结果目录中results/test1_<timestamp>.log
。results/test2_<timestamp>.log
def pytest_configure(config): """ Create a log file if log_file is not mentioned in *.ini file""" if not config.option.log_file: timestamp = datetime.strftime(datetime.now(), '%Y-%m-%d_%H-%M-%S') config.option.log_file = 'log.' + timestamp
心有法竹
相关分类