Skip to content

Commit

Permalink
fix async issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiuchingau committed Feb 27, 2025
1 parent 081ccc6 commit cff9f09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,16 @@ async def _main(cfg: TestConfig) -> None:
ui.print_error("Platform is still detected, cannot start tests")
return

device_info = await stacker._driver.get_device_info()
report.set_tag(device_info.sn if device_info.sn else "UNKNOWN")

# RUN TESTS
for section, test_run in cfg.tests.items():
ui.print_title(section.value)
await test_run(stacker, report, section.value)
try:
for section, test_run in cfg.tests.items():
ui.print_title(section.value)
await test_run(stacker, report, section.value)
except Exception as e:
ui.print_error(f"An error occurred: {e}")

# SAVE REPORT
ui.print_title("DONE")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FLEX Stacker Driver."""
import asyncio
from typing import Union, Optional
import re
from serial.tools.list_ports import comports # type: ignore[import]
Expand Down Expand Up @@ -42,7 +43,7 @@ async def build(cls, port: str = "") -> "FlexStackerInterface":
port = i.device
break
assert port, "could not find connected FLEX Stacker"
driver = await FlexStackerDriver.create(port, loop=None)
driver = await FlexStackerDriver.create(port, loop=asyncio.get_running_loop())
return cls(driver)

@classmethod
Expand Down Expand Up @@ -174,7 +175,7 @@ async def get_estop(self) -> bool:
return True

assert isinstance(self._driver, FlexStackerDriver)
_LS_RE = re.compile(r"^M112 E:(\d)\n")
_LS_RE = re.compile(r"^M112 E:(\d)$")
res = await self._driver._connection.send_data("M112\n")
match = _LS_RE.match(res)
assert match, f"Incorrect Response for E-Stop switch: {res}"
Expand Down

0 comments on commit cff9f09

Please sign in to comment.