mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	Ensure filename is shown when YAML raises an error (#6139)
* Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377
This commit is contained in:
		| @@ -22,3 +22,23 @@ def test_loading_a_broken_yaml_file(fixture_path): | ||||
|         yaml_util.load_yaml(yaml_file) | ||||
|     except EsphomeError as err: | ||||
|         assert "broken_included.yaml" in str(err) | ||||
|  | ||||
|  | ||||
| def test_loading_a_yaml_file_with_a_missing_component(fixture_path): | ||||
|     """Ensure we show the filename for a yaml file with a missing component.""" | ||||
|     yaml_file = fixture_path / "yaml_util" / "missing_comp.yaml" | ||||
|  | ||||
|     try: | ||||
|         yaml_util.load_yaml(yaml_file) | ||||
|     except EsphomeError as err: | ||||
|         assert "missing_comp.yaml" in str(err) | ||||
|  | ||||
|  | ||||
| def test_loading_a_missing_file(fixture_path): | ||||
|     """We throw EsphomeError when loading a missing file.""" | ||||
|     yaml_file = fixture_path / "yaml_util" / "missing.yaml" | ||||
|  | ||||
|     try: | ||||
|         yaml_util.load_yaml(yaml_file) | ||||
|     except EsphomeError as err: | ||||
|         assert "missing.yaml" in str(err) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user