Skip to content

Commit d15f842

Browse files
committed
Try
1 parent d0bee62 commit d15f842

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/test_init.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
class TestPlugwise: # pylint: disable=attribute-defined-outside-init
5252
"""Tests for Plugwise Smile."""
5353

54-
async def _write_json(self, call, data):
54+
async def _write_json(self, file_path, call, data):
5555
"""Store JSON data to per-setup files for HA component testing."""
5656
no_fixtures = os.getenv("NO_FIXTURES") == "1"
5757
if no_fixtures:
5858
return # pragma: no cover
5959

6060
path = os.path.join(
61-
os.path.dirname(__file__), "../fixtures/" + self.smile_setup
61+
os.path.dirname(__file__), file_path,
6262
)
6363
datafile = os.path.join(path, call + ".json")
6464
if not os.path.exists(path): # pragma: no cover
@@ -580,10 +580,21 @@ def test_and_assert(test_dict, data, header):
580580
"cooling_state"
581581
]
582582

583-
await self._write_json("data", data)
583+
await self._write_json("../fixtures/" + self.smile_setup, "data", data)
584+
prefix = "dummy"
585+
_LOGGER.debug("HOI smile_setup = %s", self.smile_setup)
586+
if str(self.smile_setup).startswith("adam"):
587+
_LOGGER.debug("HOI starts with adam = True")
588+
prefix = "adam"
589+
if str(self.smile_setup).startswith("anna"):
590+
_LOGGER.debug("HOI starts with anna = True")
591+
prefix = "anna"
592+
_LOGGER.debug("HOI prefix = %s", prefix)
593+
_LOGGER.debug("HOI path = %s", f"../tests/data/{prefix}/")
594+
await self._write_json(f"../tests/data/{prefix}/", self.smile_setup, {"devices": data})
584595

585596
if "FIXTURES" in os.environ:
586-
_LOGGER.info("Skipping tests: Requested fixtures only") # pragma: no cover
597+
_LOGGER.info("Skipping tests-: Requested fixtures only") # pragma: no cover
587598
return # pragma: no cover
588599

589600
self.entity_list = list(data.keys())

0 commit comments

Comments
 (0)