How to use __code_descr method in yandex-tank

Best Python code snippet using yandex-tank

screen.py

Source:screen.py Github

copy

Full Screen

...642 return colors[(left, right)]643 return self.screen.markup.MAGENTA644 else:645 return ''646 def __code_descr(self, code):647 if int(code) in util.HTTP:648 return util.HTTP[int(code)]649 else:650 return 'N/A'651 def render(self, expected_width=None):652 prepared = [(self.screen.markup.WHITE, self.title)]653 if not self.overall_dist:654 prepared.append(('',))655 else:656 data = []657 for code, count in sorted(self.overall_dist.items()):658 if code in self.last_dist:659 last_count = self.last_dist[code]660 else:661 last_count = 0662 data.append({663 'count': count,664 'last': last_count,665 'percent': 100 * safe_div(count, self.total_count),666 'code': code,667 'description': self.__code_descr(code)668 })669 table = self.formatter.render_table(data, ['count', 'last', 'percent', 'code', 'description'])670 for num, line in enumerate(data):671 color = self.__code_color(line['code'])672 prepared.append((color, table[num][0]))673 self.width, self.lines = self.fill_rectangle(prepared)674class CurrentNetBlock(AbstractBlock):675 ''' NET codes with highlight'''676 def __init__(self, screen):677 AbstractBlock.__init__(self, screen)678 self.overall_dist = defaultdict(int)679 self.title = 'Net codes:'680 self.total_count = 0681 template = {682 'count': {'tpl': '{:>,}'}, # noqa: E241683 'last': {'tpl': '+{:>,}'}, # noqa: E241684 'percent': {'tpl': '{:>.2f}%'}, # noqa: E241685 'code': {'tpl': '{:>2}', 'final': '{{{:}:<{len}}}'}, # noqa: E241686 'description': {'tpl': '{:<10}', 'final': '{{{:}:<{len}}}'}687 }688 delimiters = [' ', ' ', ' : ', ' ']689 self.formatter = TableFormatter(template, delimiters)690 def add_second(self, data):691 self.last_dist = data["overall"]["net_code"]["count"]692 for code, count in self.last_dist.items():693 self.total_count += count694 self.overall_dist[code] += count695 def __code_descr(self, code):696 if int(code) in util.NET:697 return util.NET[int(code)]698 else:699 return 'N/A'700 def __code_color(self, code):701 if code in self.last_dist:702 if int(code) == 0:703 return self.screen.markup.GREEN704 elif int(code) == 314:705 return self.screen.markup.MAGENTA706 else:707 return self.screen.markup.RED708 else:709 return ''710 def render(self, expected_width=None):711 prepared = [(self.screen.markup.WHITE, self.title)]712 if not self.overall_dist:713 prepared.append(('',))714 else:715 data = []716 for code, count in sorted(self.overall_dist.items()):717 if code in self.last_dist:718 last_count = self.last_dist[code]719 else:720 last_count = 0721 data.append({722 'count': count,723 'last': last_count,724 'percent': 100 * safe_div(count, self.total_count),725 'code': code,726 'description': self.__code_descr(code)727 })728 table = self.formatter.render_table(data, ['count', 'last', 'percent', 'code', 'description'])729 for num, line in enumerate(data):730 color = self.__code_color(line['code'])731 prepared.append((color, table[num][0]))732 self.width, self.lines = self.fill_rectangle(prepared)733class AnswSizesBlock(AbstractBlock):734 ''' Answer and response sizes, if available '''735 def __init__(self, screen, sizes_max_spark=120):736 AbstractBlock.__init__(self, screen)737 self.sparkline = Sparkline(sizes_max_spark)738 self.overall = {'count': 0, 'Response': 0, 'Request': 0}739 self.last = {'count': 0, 'Response': 0, 'Request': 0}740 self.title = 'Average Sizes (all/last), bytes:'...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful