compose-viz/tests/test_parser.py

19 lines
582 B
Python
Raw Normal View History

2022-05-19 00:34:26 +08:00
import pytest
from compose_viz.parser import Parser
2022-05-19 00:41:08 +08:00
def test_parser_error_parsing_file() -> None:
2022-05-19 00:34:26 +08:00
with pytest.raises(RuntimeError, match=r"Error parsing file 'tests/in/invalid.yaml'.*"):
Parser().parse("tests/in/invalid.yaml")
2022-05-19 00:41:08 +08:00
def test_parser_invalid_yaml() -> None:
2022-05-19 00:34:26 +08:00
with pytest.raises(RuntimeError, match=r"Empty yaml file, aborting."):
Parser().parse("tests/in/000000.yaml")
2022-05-19 00:41:08 +08:00
def test_parser_no_services_found() -> None:
2022-05-19 00:34:26 +08:00
with pytest.raises(RuntimeError, match=r"No services found, aborting."):
Parser().parse("tests/in/no-services.yaml")