Esempio n. 1
0
 def _draw_stop(self, remaining, status, exception=None, **kwargs):
     if status == "error":
         _, exception, _ = clean_exception(exception)
         self.bar.bar_style = "danger"
         self.elapsed_time.value = (
             '<div style="padding: 0px 10px 5px 10px"><b>Exception</b> '
             "<tt>" + repr(exception) + "</tt>:" +
             format_time(self.elapsed) + " " + "</div>")
     elif not remaining:
         self.bar.bar_style = "success"
         self.elapsed_time.value = (
             '<div style="padding: 0px 10px 5px 10px"><b>Finished:</b> ' +
             format_time(self.elapsed) + "</div>")
Esempio n. 2
0
    async def f():
        async with Server({"ping": pingpong},
                          blocked_handlers=["ping"]) as server:
            await server.listen(8881)

            comm = await connect(server.address)
            await comm.write({"op": "ping"})
            msg = await comm.read()

            _, exception, _ = clean_exception(msg["exception"])
            assert isinstance(exception, ValueError)
            assert "'ping' handler has been explicitly disallowed" in repr(
                exception)

            await comm.close()
Esempio n. 3
0
    def _draw_stop(self,
                   remaining,
                   status,
                   exception=None,
                   key=None,
                   **kwargs):
        for k, v in remaining.items():
            if not v:
                self.bars[k].bar_style = "success"
            else:
                self.bars[k].bar_style = "danger"

        if status == "error":
            _, exception, _ = clean_exception(exception)
            # self.bars[self.func(key)].bar_style = 'danger'  # TODO
            self.elapsed_time.value = (
                '<div style="padding: 0px 10px 5px 10px"><b>Exception</b> ' +
                "<tt>" + repr(exception) + "</tt>:" +
                format_time(self.elapsed) + " " + "</div>")
        else:
            self.elapsed_time.value = (
                '<div style="padding: 0px 10px 5px 10px"><b>Finished:</b> ' +
                format_time(self.elapsed) + "</div>")