Skip to content

Commit 1f9c7c4

Browse files
committed
add test
1 parent 5bd86aa commit 1f9c7c4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/test_config.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from packaging.version import parse as parse_version
55

66
from pum.pum_config import PumConfig
7-
from pum.exceptions import PumConfigError
7+
from pum.exceptions import PumConfigError, PumException
88
from pum.hook import HookHandler
99
import os
1010
import platform
@@ -63,6 +63,23 @@ def test_version(self) -> None:
6363
)
6464
self.assertIsNone(last_version_result)
6565

66+
def test_empty_changelogs_directory(self) -> None:
67+
"""Test that an empty changelogs directory raises PumException."""
68+
import tempfile
69+
70+
with tempfile.TemporaryDirectory() as tmp:
71+
tmp_path = Path(tmp)
72+
# Create an empty changelogs directory
73+
(tmp_path / "changelogs").mkdir()
74+
cfg = PumConfig(
75+
base_path=tmp_path,
76+
pum={"module": "test_empty"},
77+
validate=False,
78+
)
79+
with self.assertRaises(PumException) as ctx:
80+
cfg.changelogs()
81+
self.assertIn("is empty", str(ctx.exception))
82+
6683
def test_hooks(self) -> None:
6784
"""Test hooks."""
6885
cfg = PumConfig.from_yaml(Path("test") / "data" / "pre_post_sql_files" / ".pum.yaml")

0 commit comments

Comments
 (0)