def __init__(self, executor_widgets): self.log_widget = ScrollingLog() self.latest_stats = LatestStats() self.cumulative_stats = CumulativeStats() stats_pane = Pile([(WEIGHT, 0.333, self.latest_stats), (WEIGHT, 0.667, self.cumulative_stats)]) self.graphs = ThreeGraphs() self.logo = TaurusLogo() ordered_widgets = sorted(executor_widgets, key=lambda x: x.priority) right_widgets = ListBox( SimpleListWalker([Pile([x, Divider()]) for x in ordered_widgets])) widget_pile = Pile([ (7, self.logo), right_widgets, ]) log_block = Pile([(1, Filler(Divider('─'))), self.log_widget]) right_pane = Pile([(WEIGHT, 0.667, widget_pile), (WEIGHT, 0.333, log_block)]) columns = [(WEIGHT, 0.25, self.graphs), (WEIGHT, 0.50, stats_pane), (WEIGHT, 0.25, right_pane)] super(TaurusConsole, self).__init__(columns)
def test_table_empty(): rows = [] table = ResponsiveTable(MockUI(), SimpleListWalker(rows)) canvas = table.render((80, 20), focus=False) text = [bytes().join([t for at, cs, t in ln]) for ln in canvas.content()] assert len(text) == 20 assert text[0] == b" " * 80
def test_assemble_rows_long_text(): rows = [[get_random_text_widget(10), get_random_text_widget(300)] for _ in range(5)] assembled_rows = assemble_rows(rows, ignore_columns=[1]) lb = WidgetBase(MockUI(), SimpleListWalker(assembled_rows)) canvas = lb.render((80, 20), focus=False) text = [bytes().join([t for at, cs, t in ln]) for ln in canvas.content()] logging.info("%r", text) assert len(text) == 20 first_col, second_col = text[0].split(b" ", 1) assert first_col == rows[0][0].text.encode("utf-8") assert rows[0][1].text.encode("utf-8").startswith(second_col)
def test_table_random_data(): rows = [ ResponsiveRowWidget( [get_random_text_widget(random.randint(2, 9)) for _ in range(5)]) for _ in range(5) ] table = ResponsiveTable(MockUI(), SimpleListWalker(rows)) canvas = table.render((80, 20), focus=False) text = [bytes().join([t for at, cs, t in ln]) for ln in canvas.content()] logging.info("%r", text) assert len(text) == 20 assert text[0].startswith( rows[0].original_widget.widget_list[0].text.encode("utf-8"))
def __init__(self, sidebar_widgets): self.log_widget = ScrollingLog() self.latest_stats = LatestStats() self.cumulative_stats = CumulativeStats() stats_pane = Pile([(WEIGHT, 0.33, self.latest_stats), (WEIGHT, 0.67, self.cumulative_stats), ]) self.graphs = ThreeGraphs() right_widgets = ListBox(SimpleListWalker([Pile([x, Divider()]) for x in sidebar_widgets])) self.logo = TaurusLogo() right_pane = Pile([(10, self.logo), right_widgets, (1, Filler(Divider('─'))), (WEIGHT, 1, self.log_widget)]) columns = [(WEIGHT, 0.25, self.graphs), (WEIGHT, 0.50, stats_pane), (WEIGHT, 0.25, right_pane)] super(TaurusConsole, self).__init__(columns)
def __init__(self, key): super(RCodesList, self).__init__(SimpleListWalker([])) self.key = key
def __init__(self, key): super(DetailedErrorString, self).__init__(SimpleListWalker([])) self.key = key
def __init__(self): super(SampleLabelsAvgRT, self).__init__(SimpleListWalker([])) self.header = Text(("stat-hdr", " Avg Time "), align=RIGHT) self.body.append(self.header)
def __init__(self): super(SampleLabelsFailed, self).__init__(SimpleListWalker([])) self.header = Text(("stat-hdr", " Failures "), align=CENTER) self.body.append(self.header)
def __init__(self): super(SampleLabelsNames, self).__init__(SimpleListWalker([])) self.header = Text(("stat-hdr", " Labels ")) self.body.append(self.header)
def __init__(self, key): super(PercentilesList, self).__init__(SimpleListWalker([])) self.key = key
def __init__(self): body = SimpleListWalker([]) super(ScrollingLog, self).__init__(body) self.last_size = (0, 0)