diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..f825737cd 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + fixed: + - Fix changelog encoding test to skip when changelog_entry.yaml is empty after versioning diff --git a/policyengine_uk_data/tests/test_changelog_encoding.py b/policyengine_uk_data/tests/test_changelog_encoding.py index fa8dfd2dd..087aedb70 100644 --- a/policyengine_uk_data/tests/test_changelog_encoding.py +++ b/policyengine_uk_data/tests/test_changelog_encoding.py @@ -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: @@ -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: