1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 12:53:00 +00:00
kiwi-scp/tests/test_project.py

29 lines
744 B
Python
Raw Normal View History

2021-10-22 15:50:26 +00:00
from pathlib import Path
2021-10-25 10:08:04 +00:00
import pytest
2021-10-22 15:50:26 +00:00
from kiwi_scp.instance import Project
def test_example():
p = Project.from_directory(Path("example/hello-world.project"))
assert p.directory == Path("example/hello-world.project")
2021-10-25 10:08:04 +00:00
assert p.services != []
2021-10-22 15:50:26 +00:00
2021-10-25 10:08:04 +00:00
def test_caching():
p = Project.from_directory(Path("example/hello-world.project"))
2021-10-22 15:50:26 +00:00
2021-10-25 10:08:04 +00:00
assert p is Project.from_directory(Path("example/hello-world.project"))
2021-10-22 15:50:26 +00:00
2021-10-25 10:08:04 +00:00
def test_no_such_dir():
nonexistent_path = Path("nonexistent")
2021-10-22 15:50:26 +00:00
2021-10-25 10:08:04 +00:00
with pytest.raises(FileNotFoundError) as exc_info:
Project.from_directory(nonexistent_path)
2021-10-22 15:50:26 +00:00
2021-10-25 10:08:04 +00:00
from kiwi_scp._constants import COMPOSE_FILE_NAME
assert exc_info.value.filename == str(nonexistent_path.joinpath(COMPOSE_FILE_NAME))