def tear_down(self) -> None: # prevent re-entering the tear down procedure if not self._tearing_down: self._tearing_down = True else: return # fail remaining tests while True: test = self.next_test() if test is None: break self._record_result(test=test, outcome=Error(SimFailure), wall_time_s=0, sim_time_ns=0) # Write out final log messages self._log_test_summary() # Generate output reports self.xunit.write() if self._cov: self._cov.stop() self.log.info("Writing coverage data") self._cov.save() self._cov.html_report() if cocotb._library_coverage is not None: # TODO: move this once we have normal shutdown behavior to _sim_event cocotb._library_coverage.stop() cocotb._library_coverage.save() # Setup simulator finalization simulator.stop_simulator()
def tear_down(self) -> None: # fail remaining tests while True: test = self.next_test() if test is None: break self._record_result(test=test, outcome=Error(SimFailure), wall_time_s=0, sim_time_ns=0) # Write out final log messages self._log_test_summary() self._log_sim_summary() self.log.info("Shutting down...") # Generate output reports self.xunit.write() if self._cov: self._cov.stop() self.log.info("Writing coverage data") self._cov.save() self._cov.html_report() # Setup simulator finalization simulator.stop_simulator()
async def test_coro_from_async(dut): """Test that async coroutines are able to call regular ones""" v = await produce.coro(Value(1)) assert v == 1 try: await produce.coro(Error(MyException)) except MyException: pass else: assert False
async def test_async_from_async(dut): """Test that async coroutines are able to call raw async functions""" v = await produce.async_(Value(1)) assert v == 1 try: await produce.async_(Error(MyException)) except MyException: pass else: assert False
async def test_annotated_async_from_async(dut): """Test that async coroutines are able to call themselves""" v = await produce.async_annotated(Value(1)) assert v == 1 try: await produce.async_annotated(Error(MyException)) except MyException: pass else: assert False
def test_annotated_async_from_coro(dut): """ Test that normal coroutines are able to call async functions annotated with `@cocotb.coroutine` """ v = yield produce.async_annotated(Value(1)) assert v == 1 try: yield produce.async_annotated(Error(MyException)) except MyException: pass else: assert False