How to use update_local_conf method in tempest

Best Python code snippet using tempest_python

init.py

Source:init.py Github

copy

Full Screen

...73 discover_path = os.path.join(top_level_path, 'test_discover')74 testr_conf = TESTR_CONF % (top_level_path, discover_path)75 with open(testr_conf_path, 'w+') as testr_conf_file:76 testr_conf_file.write(testr_conf)77 def update_local_conf(self, conf_path, lock_dir, log_dir):78 config_parse = moves.configparser.SafeConfigParser()79 config_parse.optionxform = str80 with open(conf_path, 'w+') as conf_file:81 config_parse.readfp(conf_file)82 # Set local lock_dir in tempest conf83 if not config_parse.has_section('oslo_concurrency'):84 config_parse.add_section('oslo_concurrency')85 config_parse.set('oslo_concurrency', 'lock_path', lock_dir)86 # Set local log_dir in tempest conf87 config_parse.set('DEFAULT', 'log_dir', log_dir)88 # Set default log filename to tempest.log89 config_parse.set('DEFAULT', 'log_file', 'tempest.log')90 def copy_config(self, etc_dir, config_dir):91 shutil.copytree(config_dir, etc_dir)92 def generate_sample_config(self, local_dir, config_dir):93 conf_generator = os.path.join(config_dir,94 'config-generator.tempest.conf')95 subprocess.call(['oslo-config-generator', '--config-file',96 conf_generator],97 cwd=local_dir)98 def create_working_dir(self, local_dir, config_dir):99 # Create local dir if missing100 if not os.path.isdir(local_dir):101 LOG.debug('Creating local working dir: %s' % local_dir)102 os.mkdir(local_dir)103 else:104 raise OSError("Directory you are trying to initialize already "105 "exists: %s" % local_dir)106 lock_dir = os.path.join(local_dir, 'tempest_lock')107 etc_dir = os.path.join(local_dir, 'etc')108 config_path = os.path.join(etc_dir, 'tempest.conf')109 log_dir = os.path.join(local_dir, 'logs')110 testr_dir = os.path.join(local_dir, '.testrepository')111 # Create lock dir112 if not os.path.isdir(lock_dir):113 LOG.debug('Creating lock dir: %s' % lock_dir)114 os.mkdir(lock_dir)115 # Create log dir116 if not os.path.isdir(log_dir):117 LOG.debug('Creating log dir: %s' % log_dir)118 os.mkdir(log_dir)119 # Create and copy local etc dir120 self.copy_config(etc_dir, config_dir)121 # Generate the sample config file122 self.generate_sample_config(local_dir, config_dir)123 # Update local confs to reflect local paths124 self.update_local_conf(config_path, lock_dir, log_dir)125 # Generate a testr conf file126 self.generate_testr_conf(local_dir)127 # setup local testr working dir128 if not os.path.isdir(testr_dir):129 subprocess.call(['testr', 'init'], cwd=local_dir)130 def take_action(self, parsed_args):131 config_dir = parsed_args.config_dir or get_tempest_default_config_dir()...

Full Screen

Full Screen

cmd_devel.py

Source:cmd_devel.py Github

copy

Full Screen

...51 argv.append("--verbose")52 if args.retain_history:53 argv.append("--retain-history")54 return argv55def update_local_conf(repo, values):56 """Create/update local gbs.conf"""57 parser = BrainConfigParser()58 conf_fn = os.path.join(repo.path, '.gbs.conf')59 log.info('Updating local .gbs.conf')60 with open(conf_fn, 'a+') as conf_fp:61 parser.readfp(conf_fp)62 for section, items in values.iteritems():63 for key, value in items.iteritems():64 parser.set_into_file(section, key, value)65 parser.update()66 log.info('Committing local .gbs.conf to git')67 repo.add_files(['.gbs.conf'])68 repo.commit_all(msg="Autoupdate local .gbs.conf\n\nGbp-Rpm: Ignore")69def main(args):70 """gbs devel entry point."""71 try:72 repo = RpmGitRepository(args.gitdir)73 except GitRepositoryError, err:74 raise GbsError(str(err))75 tmp = Temp(prefix='gbp_', dirn=configmgr.get('tmpdir', 'general'),76 directory=True)77 packaging_dir = get_packaging_dir(args)78 # Guess spec from correct branch79 packaging_branch = configmgr.get('packaging_branch', 'orphan-devel')80 commit_id = packaging_branch if packaging_branch else 'WC.UNTRACKED'81 specfile = guess_spec(repo.path, packaging_dir, args.spec, commit_id)[0]82 # Get current branch83 try:84 current_branch = repo.get_branch()85 except GitRepositoryError:86 current_branch = None87 gbp_args = compose_gbp_args(repo, tmp.path, specfile, args)88 # Run gbp command89 if args.action == 'start':90 ret = gbp_pq_rpm(gbp_args + ['import'])91 if not ret:92 update_local_conf(repo, {'orphan-devel':93 {'packaging_branch': current_branch}})94 elif args.action == 'export':95 log.info('Exporting patches to packaging branch')96 ret = gbp_pq_rpm(gbp_args + ['export'])97 elif args.action == 'switch':98 ret = gbp_pq_rpm(gbp_args + ['switch'])99 elif args.action == 'drop':100 ret = gbp_pq_rpm(gbp_args + ['drop'])101 elif args.action == 'convert':102 log.info('Converting package to orphan-packaging git layout')103 ret = gbp_pq_rpm(gbp_args + ['convert'])104 if not ret:105 log.info("You can now create the development branch with "106 "'gbs devel start'")...

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