Пример #1
0
def _write(root, name, data):
    fname = os.path.join(root, ".%s.toml" % name)

    try:
        with open(fname, "w") as f:
            toml.dump(data, f)
            schema.validate(data)
    except IOError:
        raise

    return data
Пример #2
0
def test_cli_save():
    """Saving uploads inventory to database"""
    with open(os.path.join(self._tempdir, ".inventory.toml"), "w") as f:
        toml.dump(self._inventory, f)

    with open(os.path.join(self._tempdir, ".config.toml"), "w") as f:
        toml.dump(self._config, f)

    assert 0 == subprocess.call(
        [sys.executable, "-u", "-m", "avalon.inventory", "--save"],
        cwd=self._tempdir)