Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
fixed:
- Fix changelog encoding test to skip when changelog_entry.yaml is empty after versioning
12 changes: 12 additions & 0 deletions policyengine_uk_data/tests/test_changelog_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def test_changelog_entry_is_valid_utf8(self):
# Read as bytes and try to decode as UTF-8
content_bytes = changelog_entry_path.read_bytes()

# Skip if file is empty (happens after versioning workflow consumes it)
if not content_bytes.strip():
pytest.skip("changelog_entry.yaml is empty")

try:
content_bytes.decode("utf-8")
except UnicodeDecodeError as e:
Expand All @@ -56,11 +60,19 @@ def test_changelog_entry_is_valid_yaml(self):

content = changelog_entry_path.read_text(encoding="utf-8")

# Skip if file is empty (happens after versioning workflow consumes it)
if not content.strip():
pytest.skip("changelog_entry.yaml is empty")

try:
data = yaml.safe_load(content)
except yaml.YAMLError as e:
pytest.fail(f"changelog_entry.yaml is not valid YAML: {e}")

# Skip if data is None (empty YAML)
if data is None:
pytest.skip("changelog_entry.yaml is empty")

# Verify structure
assert isinstance(data, list), "changelog_entry.yaml must be a list"
for entry in data:
Expand Down