How to use deploy_artifacts method in avocado

Best Python code snippet using avocado_python

deploy_artifacts.py

Source:deploy_artifacts.py Github

copy

Full Screen

1import os2import codecs3import sys4import shutil5import argparse6import glob7class Deploy_Artifacts(object):8 def __init__(self, library):9 self.library = library10 self.folder = 'Referencefiles'11 self.green = '\033[0;32m'12 self.CRED = '\033[91m'13 self.CEND = '\033[0m'14 sys.path.append('bin/CITests')15 from _config import new_ref_file, update_ref_file16 self.new_ref_file = new_ref_file17 self.update_ref_file = update_ref_file18 def _get_changed_ref(self): # list all changed reference results to a list19 changed_file = codecs.open(self.new_ref_file, "r", encoding='utf8')20 lines = changed_file.readlines()21 changed_ref = []22 for line in lines:23 if line.find("txt") > -1 and line.find("ReferenceResults") > -1 and line.find("Resources") > -1:24 line = line.strip()25 ref = line[line.find(self.library):line.rfind("txt") + 3]26 changed_ref.append(ref)27 continue28 else:29 continue30 changed_file.close()31 return changed_ref32 def _get_update_ref(self):33 updated_file = codecs.open(self.update_ref_file, "r", encoding='utf8')34 lines = updated_file.readlines()35 updated_ref = []36 for line in lines:37 if line.find("txt") > -1:38 line = line.strip()39 updated_ref.append(f'{self.library}{os.sep}Resources{os.sep}ReferenceResults{os.sep}Dymola{os.sep}{line.strip()}')40 continue41 else:42 continue43 updated_file.close()44 return updated_ref45 def copy_txt(self, changed_ref): # Copy reference results from AixLib\Resources\ReferenceResults\Dymola\* to Referencefiles\\*46 if os.path.exists(self.folder) is False:47 os.mkdir(self.folder)48 else:49 files = os.listdir(self.folder)50 for file in files:51 os.remove(f'{self.folder}{os.sep}{file}')52 for ref in changed_ref:53 destination = self.folder + os.sep + ref[ref.rfind(os.sep):]54 try:55 shutil.copy(ref, destination)56 continue57 except FileNotFoundError:58 print(f'{self.CRED}Cannot find folder:{self.CEND} {destination}')59if __name__ == '__main__':60 parser = argparse.ArgumentParser(description='deploy artifacts')61 unit_test_group = parser.add_argument_group("arguments to run deploy artifacts")62 unit_test_group.add_argument("-L", "--library", default="AixLib", help="Library to test")63 unit_test_group.add_argument("--ref", help='Deploy new reference files', action="store_true")64 unit_test_group.add_argument("--new-ref",65 help="Plot new models with new created reference files",66 action="store_true")67 unit_test_group.add_argument("--updated-ref",68 help="Plot new models with new created reference files",69 action="store_true")70 args = parser.parse_args()71 from deploy_artifacts import Deploy_Artifacts72 if args.ref is True:73 ref_artifact = Deploy_Artifacts(library=args.library)74 if args.new_ref is True: # python bin/02_CITests/deploy/deploy_artifacts.py --library AixLib --ref --new-ref75 changed_ref = ref_artifact._get_changed_ref()76 ref_artifact.copy_txt(changed_ref)77 if args.updated_ref is True: # python bin/02_CITests/deploy/deploy_artifacts.py --library AixLib --ref --updated-ref78 updated_ref = ref_artifact._get_update_ref()...

Full Screen

Full Screen

lz_deploy_artifacts.py

Source:lz_deploy_artifacts.py Github

copy

Full Screen

...31 env = context.environment.get("environment")32 response = False33 if artifacts:34 if timeout:35 response = deploy_artifacts(36 artifacts, s3_prefix, region, env, timeout=int(timeout)37 )38 else:39 response = deploy_artifacts(artifacts, s3_prefix, region, env)40 return response41 except BaseException as error:42 LOGGER.error(f'Hook failed for module: {str(context.environment["module_name"])}')43 LOGGER.error(f'{str(context.environment["module_name"])}: {"".join(traceback.TracebackException.from_exception(error).format())}')...

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