mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	[core] Fix substitution id redefinition false positive (#11603)
This commit is contained in:
		| @@ -261,6 +261,17 @@ def test_device_duplicate_id( | ||||
|     assert "ID duplicate_device redefined!" in captured.out | ||||
|  | ||||
|  | ||||
| def test_substitution_with_id( | ||||
|     yaml_file: Callable[[str], str], capsys: pytest.CaptureFixture[str] | ||||
| ) -> None: | ||||
|     """Test that a ids coming from substitutions do not cause false positive ID redefinition.""" | ||||
|     load_config_from_fixture( | ||||
|         yaml_file, "id_collision_with_substitution.yaml", FIXTURES_DIR | ||||
|     ) | ||||
|     captured = capsys.readouterr() | ||||
|     assert "ID some_switch_id redefined!" not in captured.out | ||||
|  | ||||
|  | ||||
| def test_add_platform_defines_priority() -> None: | ||||
|     """Test that _add_platform_defines runs after globals. | ||||
|  | ||||
|   | ||||
| @@ -0,0 +1,12 @@ | ||||
| esphome: | ||||
|   name: test | ||||
|  | ||||
| host: | ||||
|  | ||||
| substitutions: | ||||
|   support_switches: | ||||
|     - platform: gpio | ||||
|       id: some_switch_id | ||||
|       pin: 12 | ||||
|  | ||||
| switch: $support_switches | ||||
		Reference in New Issue
	
	Block a user