def _write_config(data, request, filename):
"""
Write configuration data to file.
:param str Sequence | Mapping data: data to write to file, YAML compliant
:param pytest._pytest.fixtures.SubRequest request: test case that
requested a fixture from which this function was called
:param str filename: name for the file to write
:return str: full path to the file written
"""
# We get cleanup for free by writing to file in requests temp folder.
dirpath = request.getfixturevalue("tmpdir").strpath
filepath = os.path.join(dirpath, filename)
with open(filepath, 'w') as conf_file:
yaml.safe_dump(data, conf_file)
return filepath
评论列表
文章目录