compose-viz/tests/test_parser.py

19 lines
631 B
Python
Raw Normal View History

2022-05-18 18:34:26 +02:00
import pytest
from compose_viz.parser import Parser
2022-05-27 13:56:30 +02:00
def test_parser_invalid_yaml() -> None:
2022-05-24 10:02:47 +02:00
with pytest.raises(RuntimeError, match=r"Error parsing file 'tests/ymls/others/invalid.yml'.*"):
Parser().parse("tests/ymls/others/invalid.yml")
2022-05-18 18:34:26 +02:00
2022-05-27 13:56:30 +02:00
def test_parser_empty_yaml() -> None:
2022-05-27 13:56:15 +02:00
with pytest.raises(RuntimeError, match=r"Error parsing file 'tests/ymls/others/empty.yml'.*"):
2022-05-24 10:02:47 +02:00
Parser().parse("tests/ymls/others/empty.yml")
2022-05-18 18:34:26 +02:00
2022-05-18 18:41:08 +02:00
def test_parser_no_services_found() -> None:
2022-05-27 13:56:15 +02:00
with pytest.raises(AssertionError, match=r"No services found, aborting."):
2022-05-24 10:02:47 +02:00
Parser().parse("tests/ymls/others/no-services.yml")