Skip to main content

Create or check file/directory trees described by YAML

Project description

See Build Status on Travis CI See Build Status on AppVeyor

Create or check file/directory trees described by YAML


This Pytest plugin was generated with Cookiecutter along with @hackebrot’s Cookiecutter-pytest-plugin template.

Features

  • Monkey-patches py.path.local class (the one behind tmpdir fixture) to append yaml_create and yaml_check methods for easy access.

  • Use it like this:

    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
        """)
    

Requirements

  • PyYAML

Installation

You can install “pytest-yamltree” via pip from PyPI:

$ pip install pytest-yamltree

Usage

  • TODO

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, “pytest-yamltree” is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-yamltree, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pytest_yamltree-0.1.1-py2.py3-none-any.whl (6.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page