创建或检查yaml描述的文件/目录树
pytest-yamltree的Python项目详细描述
创建或检查yaml描述的文件/目录树
这个Pytest插件是用Cookiecutter和@hackebrot的Cookiecutter-pytest-plugin模板生成的。
功能
monkey补丁py.path.local类(位于tmpdirfixture后面的一个)附加
yaml_create
和yaml_check
方法以便于访问。像这样使用:
def test_foo(tmpdir): tmpdir.yaml_create(""" directory_one: file1: Hello World file2: "Including\nLine\nBreaks\n" subdir: file3: | Some raw content here. It is probably better readable. directory_two: arrow.gif: !!binary | R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs= """) # now these files are created under tmpdir assert tmpdir.join('directory_one', 'file1').read() == 'Hello World' # also can check that directory structure corresponds to the declaration tmpdir.yaml_check(""" directory_one: file1: Content directory_two: {} # empty mapping means empty directory """)
要求
- 皮亚姆
用法
- 待办事项
贡献
我们非常欢迎您的贡献。测试可以用tox运行,请确保 在提交请求之前,覆盖范围至少保持不变。
许可证
“pytest yamltree”是根据MIT许可证的条款发布的免费开源软件
问题
如果您遇到任何问题,请file an issue连同详细说明。