conftest.py 953 B

123456789101112131415161718192021222324252627282930313233343536
  1. """Conftest for integration tests.
  2. Stubs out homeassistant and voluptuous so the component package can be
  3. imported without the full HA stack installed (integration group only needs
  4. caldav, icalendar, and pytest).
  5. """
  6. import sys
  7. from pathlib import Path
  8. from types import ModuleType
  9. from unittest.mock import MagicMock
  10. import pytest
  11. sys.path.insert(0, str(Path(__file__).parents[1]))
  12. _HA_MODULES = [
  13. "voluptuous",
  14. "homeassistant",
  15. "homeassistant.config_entries",
  16. "homeassistant.const",
  17. "homeassistant.core",
  18. "homeassistant.helpers",
  19. "homeassistant.helpers.config_validation",
  20. "homeassistant.helpers.entity",
  21. "homeassistant.helpers.event",
  22. "homeassistant.helpers.storage",
  23. "homeassistant.helpers.update_coordinator",
  24. "homeassistant.util",
  25. "homeassistant.util.dt",
  26. "homeassistant.components",
  27. "homeassistant.components.sensor",
  28. ]
  29. for _mod in _HA_MODULES:
  30. if _mod not in sys.modules:
  31. sys.modules[_mod] = MagicMock()