return True @DeviceTest.test(reboot=False) async def frag_pkgversion(self) -> bool: msg = await self.upmsg() self.dl(msg, Frag.PORT, struct.pack('B', Frag.PKG_VERSION)) msg, m = await self.ul(Frag.PORT) c, p, v = struct.unpack('BBB', m['FRMPayload']) assert c == Frag.PKG_VERSION and p == Frag.PKG_ID and v == 1 return True if __name__ == '__main__': p = argparse.ArgumentParser() LoRaWANTest.stdargs(p) args = p.parse_args() colorama_init() if args.virtual_time: asyncio.set_event_loop(VirtualTimeLoop()) # type: ignore sim = Simulation(args.hexfiles, args.debug, args.traffic) test = FuotaTest(sim, args) if not asyncio.get_event_loop().run_until_complete(test.run()): sys.exit(1)
def vtime() -> Generator[None, None, None]: loop = asyncio.get_event_loop() asyncio.set_event_loop(VirtualTimeLoop()) # type: ignore yield asyncio.set_event_loop(loop)
def vtime(): loop = asyncio.get_event_loop() asyncio.set_event_loop(VirtualTimeLoop()) yield asyncio.set_event_loop(loop)