Best Python code snippet using yandex-tank
test_plugin.py
Source:test_plugin.py
...4from yandextank.core.tankcore import TankCore5from yandextank.core.tankworker import TankInfo6from yandextank.plugins.Telegraf import Plugin as TelegrafPlugin7class TestTelegrafPlugin(object):8 def test_plugin_configuration(self):9 """ testing telegraf plugin configuration """10 cfg = {11 'core': {},12 'telegraf': {13 'package': 'yandextank.plugins.Telegraf',14 'enabled': True,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):...
test_scale_to_zero.py
Source:test_scale_to_zero.py
2from datasette_scale_to_zero import get_config3import pytest4@pytest.mark.asyncio5@pytest.mark.parametrize("invalid_duration", [1, "2", "3min", "dog"])6async def test_plugin_configuration(invalid_duration):7 with pytest.raises(ValueError) as ex:8 ds = Datasette(9 memory=True,10 metadata={11 "plugins": {"datasette-scale-to-zero": {"duration": invalid_duration}}12 },13 )14 await ds.invoke_startup()15 assert (16 ex.value.args[0] == "duration must be a number followed by a unit (s, m, h)"17 )18@pytest.mark.parametrize(19 "duration,expected",20 (...
test_config.py
Source:test_config.py
...7 (20, 20),8 ],9)10@pytest.mark.asyncio11async def test_plugin_configuration(setting, expected):12 ds = Datasette(13 [],14 memory=True,15 metadata={16 "plugins": {"datasette-leaflet-geojson": {"default_maps_to_load": setting}}17 },18 )19 html = (await ds.client.get("/")).text20 assert (21 "<script>window.DATASETTE_LEAFLET_GEOJSON_DEFAULT_MAPS_TO_LOAD = {};</script>".format(22 expected23 )24 in html25 )
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!!