How to use init_logging method in yandex-tank

Best Python code snippet using yandex-tank

test_create_base_application.py

Source:test_create_base_application.py Github

copy

Full Screen

1import os2from unittest.mock import MagicMock, patch3import pytest4from datastore.shared import create_base_application5from datastore.shared.di import injector6from datastore.shared.services import EnvironmentService, ShutdownService7from tests import reset_di # noqa8@pytest.fixture()9def env_service(reset_di): # noqa10 injector.register(EnvironmentService, EnvironmentService)11 yield injector.get(EnvironmentService)12def test_create_base_application():13 flask_frontend = MagicMock()14 app = MagicMock()15 flask_frontend.create_application = ca = MagicMock(return_value=app)16 shutdown_service = MagicMock()17 get = MagicMock(return_value=shutdown_service)18 with patch("atexit.register") as register, patch(19 "datastore.shared.init_logging"20 ) as init_logging, patch.object(injector, "get", new=get) as iget:21 assert create_base_application(flask_frontend) == app22 print("", end="") # simulate that the flushprint is tested23 register.assert_called_once()24 captured_shutdown = register.call_args_list[0][0][0]25 captured_shutdown()26 iget.assert_called_with(ShutdownService)27 shutdown_service.shutdown.assert_called_once()28 init_logging.assert_called_once()29 ca.assert_called_once()30def test_create_base_application_gunicorn(env_service):31 os.environ["SERVER_SOFTWARE"] = "gunicorn"32 env_service.cache = {}33 with patch("atexit.register"), patch(34 "datastore.shared.init_logging"35 ) as init_logging:36 create_base_application(MagicMock())37 init_logging.assert_called()...

Full Screen

Full Screen

test_basic.py

Source:test_basic.py Github

copy

Full Screen

1from azfuse import File2def test_open_to_write():3 from azfuse.common import init_logging4 init_logging()5 with File.open('data/abc.txt', 'w') as fp:6 fp.write('abc')7def test_open_to_read():8 from azfuse.common import init_logging9 init_logging()10 with File.open('data/abc.txt', 'w') as fp:11 fp.write('abc')12 File.clear_cache('data/abc.txt')13 with File.open('data/abc.txt', 'r') as fp:14 x = fp.read()15 assert x == 'abc'16def test_prepare_in_batch():17 from azfuse.common import init_logging18 init_logging()19 from azfuse import File20 num = 521 for i in range(num):22 with File.open('data/batch_test/{}.txt'.format(i), 'w') as fp:23 fp.write(str(i))24 File.clear_cache('data/batch_test')25 File.prepare(['data/batch_test/{}.txt'.format(i)] for i in range(num))26 for i in range(num):27 with File.open('data/batch_test/{}.txt'.format(i), 'r') as fp:28 content = fp.read()29 assert content == str(i)30def test_async_upload():31 from azfuse.common import init_logging32 init_logging()33 from azfuse import File34 num = 535 with File.async_upload(enabled=True):36 for i in range(num):37 with File.open('data/batch_test/{}.txt'.format(i), 'w') as fp:38 fp.write(str(i + 10))39 File.clear_cache('data/batch_test')40 File.prepare(['data/batch_test/{}.txt'.format(i)] for i in range(num))41 for i in range(num):42 with File.open('data/batch_test/{}.txt'.format(i), 'r') as fp:43 content = fp.read()...

Full Screen

Full Screen

log.py

Source:log.py Github

copy

Full Screen

...17 ext = result.group(1)18 if ltype == 'basic':19 log = logger.init_basic(fname='simple.log')20 elif ltype == 'simple':21 log = logger.init_logging()22 elif ltype == 'rot':23 log = logger.init_logging(rotate_size=1000)24 elif ltype == 'trot':25# log = logger.init_logging(rotate_interval=5)26 log = logger.init_logging(rotate_seconds=30)27 elif ltype == 'code':28 log = logger.init_logging(err_file="err.log")29 elif ext == 'yml':30 log = logger.init_logging_yaml(ltype)31 elif ext == 'ini':32 log = logger.init_logging_ini(ltype)33 else:34 print("invalid arg "+ ltype)35 return 136 print("got here ")37 log.warning("BEGINS")38 log.debug('debug ')39 log.info("some info")40 log.warning("we might have a problem")41 log.error("something bad")42 sample.func1()...

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