Best Python code snippet using autotest_python
__init__.py
Source:__init__.py
...12# because the way it's done now, it requires all python database interface13# modules to be present14#15RDBMS_REGISTRY = {'mysql': MySQLDatabaseManager}16def get_manager_class(rdbms_type):17 '''18 Returns a manager class for a given RDBMS type19 '''20 klass = RDBMS_REGISTRY.get(rdbms_type, None)21 if klass is None:22 logging.info('There\'s no database manager specific for "%s"',23 rdbms_type)24 klass = DummyDatabaseManager25 return klass26def engine_to_rdbms_type(django_engine):27 '''28 Returns a RDBMS type for a given django engine name29 '''30 rdbms_type = django_engine.split('.')[-1]31 if rdbms_type == 'afe':32 rdbms_type = 'mysql'33 elif rdbms_type.startswith('afe_'):34 rdbms_type = rdbms_type[4:]35 return rdbms_type36def get_manager_class_from_engine(django_engine):37 '''38 Returns a manager class for a given django engine39 '''40 rdbms_type = engine_to_rdbms_type(django_engine)41 return get_manager_class(rdbms_type)42def get_manager_from_config(admin_password=None, rdbms_type=None):43 '''44 Returns a manager instance from the information on the configuration file45 '''46 sect = 'AUTOTEST_WEB'47 name = settings.settings.get_value(sect, 'database')48 user = settings.settings.get_value(sect, 'user')49 password = settings.settings.get_value(sect, 'password')50 host = settings.settings.get_value(sect, 'host')51 if rdbms_type is None:52 rdbms_type = settings.settings.get_value(sect, 'db_type')53 klass = get_manager_class(rdbms_type)54 manager = klass(name, admin_password=admin_password, user=user,55 password=password, host=host)...
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!!