Skip to content

Commit 7b0a6fc

Browse files
MaxGhenisclaude
andcommitted
Fix test to skip when changelog_entry.yaml is empty
The versioning workflow consumes changelog_entry.yaml, leaving it empty. This causes the test to fail on the next CI run. Add skip logic for empty files to prevent this. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 90d9264 commit 7b0a6fc

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: patch
2+
changes:
3+
fixed:
4+
- Fix changelog encoding test to skip when changelog_entry.yaml is empty after versioning

policyengine_uk_data/tests/test_changelog_encoding.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def test_changelog_entry_is_valid_utf8(self):
3434
# Read as bytes and try to decode as UTF-8
3535
content_bytes = changelog_entry_path.read_bytes()
3636

37+
# Skip if file is empty (happens after versioning workflow consumes it)
38+
if not content_bytes.strip():
39+
pytest.skip("changelog_entry.yaml is empty")
40+
3741
try:
3842
content_bytes.decode("utf-8")
3943
except UnicodeDecodeError as e:
@@ -56,11 +60,19 @@ def test_changelog_entry_is_valid_yaml(self):
5660

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

63+
# Skip if file is empty (happens after versioning workflow consumes it)
64+
if not content.strip():
65+
pytest.skip("changelog_entry.yaml is empty")
66+
5967
try:
6068
data = yaml.safe_load(content)
6169
except yaml.YAMLError as e:
6270
pytest.fail(f"changelog_entry.yaml is not valid YAML: {e}")
6371

72+
# Skip if data is None (empty YAML)
73+
if data is None:
74+
pytest.skip("changelog_entry.yaml is empty")
75+
6476
# Verify structure
6577
assert isinstance(data, list), "changelog_entry.yaml must be a list"
6678
for entry in data:

0 commit comments

Comments
 (0)