A background task that resets the state.
(self)
| 1730 | |
| 1731 | @xt.background |
| 1732 | async def background_task_reset(self): |
| 1733 | """A background task that resets the state.""" |
| 1734 | with pytest.raises(ImmutableStateError): |
| 1735 | # Resetting the state should be explicitly blocked. |
| 1736 | self.reset() |
| 1737 | |
| 1738 | async with self: |
| 1739 | self.order.append("foo") |
| 1740 | self.reset() |
| 1741 | assert not self.order |
| 1742 | async with self: |
| 1743 | self.order.append("reset") |
| 1744 | |
| 1745 | @xt.background |
| 1746 | async def background_task_generator(self): |