mirror of
https://github.com/esphome/esphome.git
synced 2024-11-19 11:17:01 +01:00
d447548893
* Basic pytest configuration * Added unit_test script that triggers pytest * Changed "fixtures" to fixture_path This is consistent with pytest's tmp_path * Initial unit tests for esphome.helpers * Disabled coverage reporting for esphome/components. Focus initial unittest efforts on the core code. * Migrated some ip_address to hypothesis * Added a hypothesis MAC address strategy * Initial tests for core * Added hypothesis to requirements * Added tests for core classes TestTimePeriod Lambda ID DocumentLocation DocumentRange Define Library * Updated test config so package root is discovered * Setup fixtures and inital tests for pins * Added tests for validate GPIO * Added tests for pin type * Added initial config_validation tests * Added more tests for config_validation * Added comparison unit tests * Added repr to core.TimePeriod. Simplified identifying faults in tests * Fixed inverted gt/lt tests * Some tests for Espcore * Updated syntax for Python3 * Removed usage of kwarg that isn't required * Started writing test cases * Started writing test cases for cpp_generator * Additional docs and more Python3 releated improvements * More test cases for cpp_generator. * Fixed linter errors * Add codegen tests to ensure file API remains stable * Add test cases for cpp_helpers
27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
import pytest
|
|
|
|
from esphome import codegen as cg
|
|
|
|
|
|
# Test interface remains the same.
|
|
@pytest.mark.parametrize("attr", (
|
|
# from cpp_generator
|
|
"Expression", "RawExpression", "RawStatement", "TemplateArguments",
|
|
"StructInitializer", "ArrayInitializer", "safe_exp", "Statement", "LineComment",
|
|
"progmem_array", "statement", "variable", "Pvariable", "new_Pvariable",
|
|
"add", "add_global", "add_library", "add_build_flag", "add_define",
|
|
"get_variable", "get_variable_with_full_id", "process_lambda", "is_template", "templatable", "MockObj",
|
|
"MockObjClass",
|
|
# from cpp_helpers
|
|
"gpio_pin_expression", "register_component", "build_registry_entry",
|
|
"build_registry_list", "extract_registry_entry_config", "register_parented",
|
|
"global_ns", "void", "nullptr", "float_", "double", "bool_", "int_", "std_ns", "std_string",
|
|
"std_vector", "uint8", "uint16", "uint32", "int32", "const_char_ptr", "NAN",
|
|
"esphome_ns", "App", "Nameable", "Component", "ComponentPtr",
|
|
# from cpp_types
|
|
"PollingComponent", "Application", "optional", "arduino_json_ns", "JsonObject",
|
|
"JsonObjectRef", "JsonObjectConstRef", "Controller", "GPIOPin"
|
|
))
|
|
def test_exists(attr):
|
|
assert hasattr(cg, attr)
|