Skip to content

Commit 73f14f0

Browse files
committed
tests(config_object): Stub out config object tests
1 parent 96c8bf8 commit 73f14f0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/test_config_object.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import pathlib
2+
3+
import pytest
4+
5+
from vcspull import config as config_tools
6+
7+
8+
@pytest.fixture
9+
def load_yaml(tmp_path: pathlib.Path):
10+
def fn(content, dir="randomdir", filename="randomfilename.yaml") -> pathlib.Path:
11+
_dir = tmp_path / dir
12+
_dir.mkdir()
13+
_config = _dir / filename
14+
_config.write_text(content, encoding="utf-8")
15+
16+
return _config
17+
18+
return fn
19+
20+
21+
def test_simple_format(load_yaml):
22+
config_file = load_yaml(
23+
"""
24+
vcspull:
25+
libvcs: git+https://github.com/vcs-python/libvcs
26+
"""
27+
)
28+
29+
config = config_tools.Config.from_yaml_file(config_file)
30+
31+
assert len(config.repos) == 1
32+
repo = config.repos[0]
33+
dir = repo.dir.parent.parent
34+
35+
assert dir / "vcspull" == repo.dir.parent
36+
assert dir / "vcspull" / "libvcs" == repo.dir

0 commit comments

Comments
 (0)