Best Python code snippet using yandex-tank
plugin.py
Source:plugin.py
...33 return ["port"]34 def configure(self):35 self.port = int(self.get_option("port", self.port))36 try:37 aggregator = self.core.get_plugin_of_type(AggregatorPlugin)38 aggregator.add_result_listener(self)39 except KeyError:40 logger.warning(41 "No aggregator module, no valid report will be available")42 try:43 mon = self.core.get_plugin_of_type(ReportPlugin)44 if mon.monitoring:45 mon.monitoring.add_listener(self)46 except KeyError:47 logger.warning("No monitoring module, monitroing report disabled")48 def prepare_test(self):49 try:50 self.server = ReportServer(self)51 self.server.owner = self52 except Exception, ex:53 logger.warning("Failed to start web results server: %s", ex)54 def start_test(self):55 self.start()56 def end_test(self, retcode):57 logger.info("Ended test. Sending command to reload pages.")...
test_plugin.py
Source:test_plugin.py
...15 'config': os.path.join(get_test_path(), 'yandextank/plugins/Telegraf/tests/telegraf_mon.xml')16 }17 }18 core = TankCore(cfg, threading.Event(), TankInfo({}))19 telegraf_plugin = core.get_plugin_of_type(TelegrafPlugin)20 telegraf_plugin.configure()21 assert telegraf_plugin.detected_conf == 'telegraf'22 def test_legacy_plugin_configuration(self):23 """ testing legacy plugin configuration, old-style monitoring """24 cfg = {25 'core': {},26 'monitoring': {27 'package': 'yandextank.plugins.Telegraf',28 'enabled': True,29 'config': os.path.join(get_test_path(), 'yandextank/plugins/Telegraf/tests/old_mon.xml')30 }31 }32 core = TankCore(cfg, threading.Event(), TankInfo({}))33 telegraf_plugin = core.get_plugin_of_type(TelegrafPlugin)34 telegraf_plugin.configure()...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!