Skip to content

Raise a clear error for empty YAML files#1482

Open
biefan wants to merge 2 commits intoAzure:mainfrom
biefan:fix-empty-yaml-seed-datasets
Open

Raise a clear error for empty YAML files#1482
biefan wants to merge 2 commits intoAzure:mainfrom
biefan:fix-empty-yaml-seed-datasets

Conversation

@biefan
Copy link
Contributor

@biefan biefan commented Mar 16, 2026

Summary

  • reject empty YAML inputs in YamlLoadable.from_yaml_file() with a clear ValueError
  • add regression coverage for both SeedDataset.from_yaml_file() and ConfigurationLoader.from_yaml_file()

Problem

yaml.safe_load() returns None for empty or whitespace-only YAML files. YamlLoadable.from_yaml_file() currently forwards that None into downstream constructors, which surfaces as internal AttributeError/TypeError exceptions depending on the caller.

Two real call paths affected today are SeedDataset.from_yaml_file() and ConfigurationLoader.from_yaml_file(), both of which currently fail with low-level exceptions instead of a clear validation error.

Testing

  • .venv/bin/pytest tests/unit/models/test_seed.py tests/unit/setup/test_configuration_loader.py -q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants