Skip to content

Commit

Permalink
tests(config_object): Stub out config object tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Sep 25, 2022
1 parent a17ae61 commit 962c71c
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/test_config_object.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import pathlib

import pytest

from vcspull import config as config_tools


@pytest.fixture
def load_yaml(tmp_path: pathlib.Path):
def fn(content, dir="randomdir", filename="randomfilename.yaml") -> pathlib.Path:
_dir = tmp_path / dir
_dir.mkdir()
_config = _dir / filename
_config.write_text(content, encoding="utf-8")

return _config

return fn


def test_simple_format(load_yaml):
config_file = load_yaml(
"""
vcspull:
libvcs: git+https://github.com/vcs-python/libvcs
"""
)

config = config_tools.Config.from_yaml_file(config_file)

assert len(config.repos) == 1
repo = config.repos[0]
dir = repo.dir.parent.parent

assert dir / "vcspull" == repo.dir.parent
assert dir / "vcspull" / "libvcs" == repo.dir

0 comments on commit 962c71c

Please sign in to comment.