How to use get_cfg method in avocado

Best Python code snippet using avocado_python

config.py

Source:config.py Github

copy

Full Screen

...25# Load .env26load_dotenv('.env')27# Conf28conf = config(os.getenv('LUFT_CONFIG', 'luft.cfg'))29def get_cfg(section, name, default=None):30 """Get configuration."""31 if conf.has_option(section, name):32 return conf.get(section, name)33 else:34 return default35# Core36ENV = os.getenv('ENV', get_cfg('core', 'env'))37TASKS_FOLDER = Path(38 os.getenv('TASKS_FOLDER', get_cfg('core', 'tasks_folder')))39JDBC_CONFIG = os.getenv('JDBC_CONFIG', get_cfg('core', 'jdbc_config'))40ES_CONFIG = os.getenv('ES_CONFIG', get_cfg('core', 'es_config'))41BLOB_STORAGE = os.getenv('BLOB_STORAGE', get_cfg('core', 'blob_storage'))42PATH_PREFIX = get_cfg('core', 'path_prefix')43# BQ44BQ_CREDENTIALS_FILE = os.getenv(45 'BQ_CREDENTIALS_FILE', get_cfg('bq', 'credentials_file'))46BQ_PROJECT_ID = os.getenv(47 'BQ_PROJECT_ID', get_cfg('bq', 'project_id'))48BQ_LOCATION = os.getenv(49 'BQ_LOCATION', get_cfg('bq', 'location'))50BQ_JOB_ID_PREFIX = os.getenv(51 'BQ_JOB_ID_PREFIX', get_cfg('bq', 'job_id_prefix'))52BQ_HIST_DEFAULT_TEMPLATE = get_cfg('bq', 'default_history_template')53BQ_STAGE_DEFAULT_TEMPLATE = get_cfg('bq', 'default_stage_template')54BQ_STAGE_NO_HIST_DEFAULT_TEMPLATE = get_cfg('bq', 'default_stage_no_hist_template')55BQ_STAGE_SCHEMA_FORM = os.getenv('BQ_STAGE_SCHEMA_FORM', get_cfg('bq', 'stage_schema_form'))56BQ_HIST_SCHEMA_FORM = os.getenv('BQ_HIST_SCHEMA_FORM', get_cfg('bq', 'hist_schema_form'))57BQ_HIST_DISABLE = os.getenv('BQ_HIST_DISABLE', get_cfg('bq', 'hist_disable'))58# GCS59GCS_BUCKET = os.getenv('GCS_BUCKET', get_cfg('gcs', 'bucket'))60GCS_AUTH_METHOD = os.getenv(61 'GCS_AUTH_METHOD', get_cfg('gcs', 'auth_method'))62GCS_EMAIL = os.getenv('GCS_EMAIL', get_cfg(63 'gcs', 'service_account_email'))64GCS_P12_KEYFILE = os.getenv(65 'GCS_P12_KEYFILE', get_cfg('gcs', 'p12_keyfile'))66GCS_JSON_KEYFILE = os.getenv(67 'GCS_JSON_KEYFILE', get_cfg('gcs', 'json_keyfile'))68GCS_APP_NAME = os.getenv('GCS_APP_NAME', get_cfg(69 'gcs', 'application_name') if get_cfg(70 'gcs', 'application_name') != '' else 'embulk-output-gcs')71# AWS72AWS_BUCKET = os.getenv('AWS_BUCKET', get_cfg('aws', 'bucket'))73AWS_ENDPOINT = os.getenv('AWS_ENDPOINT', get_cfg('aws', 'endpoint'))74AWS_ACCESS_KEY_ID = os.getenv(75 'AWS_ACCESS_KEY_ID', get_cfg('aws', 'access_key_id'))76AWS_SECRET_ACCESS_KEY = os.getenv(77 'AWS_SECRET_ACCESS_KEY', get_cfg('aws', 'secret_access_key'))78# Qlik Cloud79QLIK_CLOUD_DELAY = get_cfg('qlik_cloud', 'delay')80QLIK_CLOUD_LOGIN_URL = get_cfg('qlik_cloud', 'login_url')81QLIK_CLOUD_URL = get_cfg('qlik_cloud', 'url')82QLIK_CLOUD_USER = os.getenv(83 'QLIK_CLOUD_USER', get_cfg('qlik_cloud', 'user'))84QLIK_CLOUD_PASS = os.getenv(85 'QLIK_CLOUD_PASS', get_cfg('qlik_cloud', 'password'))86QLIK_CLOUD_HEADLESS = False if not get_cfg(87 'qlik_cloud', 'headless') or get_cfg(88 'qlik_cloud', 'headless').lower() == 'false' else True89# Qlik Enterprise Server90QLIK_ENT_HOST = os.getenv(91 'QLIK_ENT_HOST', get_cfg('qlik_enterprise', 'host'))92QLIK_ENT_PORT = os.getenv(93 'QLIK_ENT_PORT', get_cfg('qlik_enterprise', 'port'))94QLIK_ENT_CLIENT_KEY = os.getenv(95 'QLIK_ENT_CLIENT_KEY', get_cfg('qlik_enterprise', 'client_key'))96QLIK_ENT_ROOT_CERT = os.getenv(97 'QLIK_ENT_ROOT_CERT', get_cfg('qlik_enterprise', 'root_cert'))98QLIK_ENT_CLIENT_CERT = os.getenv(99 'QLIK_ENT_CLIENT_CERT', get_cfg('qlik_enterprise', 'client_cert'))100# Task Type Map101TASK_TYPE_MAPPER = conf['task_type_map']102# Embulk103EMBULK_COMMAND = os.getenv('EMBULK_COMMAND', get_cfg(104 'embulk', 'embulk_command')).split()105EMBULK_LOG_LEVEL = os.getenv('EMBULK_LOG_LEVEL', get_cfg(106 'embulk', 'embulk_log_level'))107# Embulk Default Template108EMBULK_DEFAULT_TEMPLATE = conf['embulk_default_template']109# Embulk Type map110EMBULK_TYPE_MAPPER = conf['embulk_type_map']111# Thread112DEFAULT_THREAD_CNT = int(get_cfg('thread', 'default_thread_cnt'))113THREAD_NAME_PREFIX = get_cfg('thread', 'thread_prefix')114# JDBC driver path115JDBC_DRIVER_PATH = conf['jdbc_driver_path']116# Supported data types117SNOWFLAKE_DATA_TYPES = get_cfg(118 'data_type', 'snowflake').split()119BQ_DATA_TYPES = get_cfg(...

Full Screen

Full Screen

run.py

Source:run.py Github

copy

Full Screen

...17 self.dst = None18 self.div_unit = None19 self.settings_from_config()20 def settings_from_config(self):21 random.seed(self.get_cfg("RANDOM_SEED") or datetime.now())22 self.source_path = self.get_cfg("SOURCE_PATH") or os.path.join("images", "storage", "stored")23 self.classes = self.get_cfg("INCLUDED_CLASSESS") or os.listdir(self.source_path)24 if "original" in self.classes:25 self.classes.remove("original")26 if self.get_cfg("EXCLUDED_CLASSESS"):27 for cls in self.get_cfg("EXCLUDED_CLASSESS"):28 self.classes.remove(cls)29 self.classes = list(self.classes)30 if self.get_cfg("RANDOM_CLASSESS_COUNT"):31 random.shuffle(self.classes)32 self.classes = self.classes[:self.get_cfg("RANDOM_CLASSESS_COUNT")]33 transformations = self.get_cfg("TRANSFORMATIONS") or []34 self.transformations = [locate(f"transformations.{transformation.lower()}.{transformation}") for transformation in transformations]35 processor = self.get_cfg("PROCESSOR") or "Captured"36 self.processor = locate(f"processors.{processor.lower()}.{processor}")37 self.types = self.get_cfg("TYPES")38 if not self.types:39 raise RuntimeError("key: `TYPES` is required. Please check README")40 self.div_unit = self.get_cfg("DIV_UNIT") or "%"41 self.dst = self.get_cfg("DESTINATION") or "DataSet"42 if self.get_cfg("CLEAR_DESTINATION_BEFORE") and os.path.isdir(self.dst):43 shutil.rmtree(self.dst, ignore_errors=True)44 def get_cfg(self, key):45 return self.cfg[key] if key in self.cfg else None46 def perform(self):47 self.processor.precalc_sizes(self.source_path, self.classes, self.types, self.div_unit)48 limit = len(self.classes)49 i = 150 for cls in self.classes:51 print(F"processed: {i} of {limit} classes ({cls})")52 self.processor.run(os.path.join(self.source_path, cls), self.dst, cls, self.types,53 self.transformations)54 i += 155 def print_classes(self):56 print("Selected classes:")57 print((", ").join(self.classes))58if __name__ == "__main__":...

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 avocado 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