How to use update_version method in autotest

Best Python code snippet using autotest_python

folders_database_migrator.py

Source:folders_database_migrator.py Github

copy

Full Screen

1import sqlalchemy2import os3def upgrade_database(database_connection, config_folder, running_platform):4 db_version = database_connection['version']5 db_version_dict = db_version.find_one(id=1)6 if db_version_dict['version'] == "5":7 folders_table = database_connection['folders']8 folders_table.create_column('convert_to_format', sqlalchemy.String)9 convert_to_csv_list = folders_table.find(process_edi='True')10 for line in convert_to_csv_list:11 line['convert_to_format'] = "csv"12 folders_table.update(line, ['id'])13 administrative_section = database_connection['administrative']14 administrative_section.create_column('convert_to_format', sqlalchemy.String)15 administrative_section_update_dict = administrative_section.find_one(id=1)16 administrative_section_update_dict['convert_to_format'] = "csv"17 administrative_section.update(administrative_section_update_dict, ['id'])18 update_version = dict(id=1, version="6")19 db_version.update(update_version, ['id'])20 db_version_dict = db_version.find_one(id=1)21 if db_version_dict['version'] == "6":22 processed_table = database_connection['processed_files']23 processed_table.create_column('resend_flag', sqlalchemy.Boolean)24 for line in processed_table:25 line['resend_flag'] = False26 processed_table.update(line, ['id'])27 update_version = dict(id=1, version="7")28 db_version.update(update_version, ['id'])29 db_version_dict = db_version.find_one(id=1)30 if db_version_dict['version'] == "7":31 folders_table = database_connection['folders']32 administrative_section = database_connection['administrative']33 administrative_section.create_column('tweak_edi', sqlalchemy.Boolean)34 administrative_section_update_dict = administrative_section.find_one(id=1)35 administrative_section_update_dict['tweak_edi'] = False36 administrative_section.update(administrative_section_update_dict, ['id'])37 folders_table.create_column('tweak_edi', sqlalchemy.Boolean)38 for line in folders_table:39 if line['pad_a_records'] == 'False':40 line['tweak_edi'] = False41 folders_table.update(line, ['id'])42 else:43 line['tweak_edi'] = True44 folders_table.update(line, ['id'])45 update_version = dict(id=1, version="8")46 db_version.update(update_version, ['id'])47 db_version_dict = db_version.find_one(id=1)48 if db_version_dict['version'] == "8":49 administrative_section = database_connection['administrative']50 administrative_section_update_dict = dict(id=1, single_add_folder_prior=os.path.join(os.getcwd()),51 batch_add_folder_prior=os.path.join(os.getcwd()),52 export_processed_folder_prior=os.path.join(os.getcwd()))53 administrative_section.update(administrative_section_update_dict, ['id'])54 update_version = dict(id=1, version="9")55 db_version.update(update_version, ['id'])56 db_version_dict = db_version.find_one(id=1)57 if db_version_dict['version'] == "9":58 administrative_section = database_connection['administrative']59 administrative_section_update_dict = dict(id=1, report_edi_errors=False)60 administrative_section.update(administrative_section_update_dict, ['id'])61 update_version = dict(id=1, version="10")62 db_version.update(update_version, ['id'])63 db_version_dict = db_version.find_one(id=1)64 if db_version_dict['version'] == "10":65 folders_table = database_connection['folders']66 administrative_section = database_connection['administrative']67 administrative_section.create_column('split_edi', sqlalchemy.Boolean)68 administrative_section_update_dict = administrative_section.find_one(id=1)69 administrative_section_update_dict['split_edi'] = False70 administrative_section.update(administrative_section_update_dict, ['id'])71 folders_table.create_column('split_edi', sqlalchemy.Boolean)72 for line in folders_table.all():73 line['split_edi'] = False74 folders_table.update(line, ['id'])75 update_version = dict(id=1, version="11")76 db_version.update(update_version, ['id'])77 db_version_dict = db_version.find_one(id=1)78 if db_version_dict['version'] == "11":79 administrative_section = database_connection['administrative']80 database_connection.create_table('settings')81 settings_table = database_connection['settings']82 administrative_section_dict = administrative_section.find_one(id=1)83 if administrative_section_dict['enable_reporting'] == "True":84 email_state = True85 else:86 email_state = False87 settings_table.insert(dict(enable_email=email_state,88 email_address=administrative_section_dict['report_email_address'],89 email_username=administrative_section_dict['report_email_username'],90 email_password=administrative_section_dict['report_email_password'],91 email_smtp_server=administrative_section_dict['report_email_smtp_server'],92 smtp_port=administrative_section_dict['reporting_smtp_port'],93 backup_counter=0,94 backup_counter_maximum=200,95 enable_interval_backups=True))96 update_version = dict(id=1, version="12")97 db_version.update(update_version, ['id'])98 db_version_dict = db_version.find_one(id=1)99 if db_version_dict['version'] == "12":100 administrative_section = database_connection['administrative']101 administrative_section_update_dict = dict(102 id=1,103 logs_directory=os.path.join(config_folder, "run_logs"),104 edi_converter_scratch_folder=os.path.join(config_folder, "edi_converter_scratch_folder"),105 errors_folder=os.path.join(config_folder, "errors")106 )107 administrative_section.update(administrative_section_update_dict, ['id'])108 update_version = dict(id=1, version="13")109 db_version.update(update_version, ['id'])110 db_version_dict = db_version.find_one(id=1)111 if db_version_dict['version'] == "13":112 database_connection.query(113 'update "folders" set "convert_to_format"="", "process_edi"="False" where "convert_to_format"="insight"')114 update_version = dict(id=1, version="14", os=running_platform)115 db_version.update(update_version, ['id'])116 db_version_dict = db_version.find_one(id=1)117 if db_version_dict['version'] == "14":118 database_connection.query("alter table 'folders' add column 'force_edi_validation'")119 database_connection.query('UPDATE "folders" SET "force_edi_validation" = 0')120 database_connection.query("alter table 'administrative' add column 'force_edi_validation'")121 database_connection.query('UPDATE "administrative" SET "force_edi_validation" = 0')122 update_version = dict(id=1, version="15", os=running_platform)123 db_version.update(update_version, ['id'])124 if db_version_dict['version'] == '15':125 database_connection.query("alter table 'folders' add column 'append_a_records'")126 database_connection.query('UPDATE "folders" SET "append_a_records" = "False"')127 database_connection.query("alter table 'folders' add column 'a_record_append_text'")128 database_connection.query('UPDATE "folders" SET "a_record_append_text" = ""')129 database_connection.query("alter table 'folders' add column 'force_txt_file_ext'")130 database_connection.query('UPDATE "folders" SET "force_txt_file_ext" = "False"')131 database_connection.query("alter table 'administrative' add column 'append_a_records'")132 database_connection.query('UPDATE "administrative" SET "append_a_records" = "False"')133 database_connection.query("alter table 'administrative' add column 'a_record_append_text'")134 database_connection.query('UPDATE "administrative" SET "a_record_append_text" = ""')135 database_connection.query("alter table 'administrative' add column 'force_txt_file_ext'")136 database_connection.query('UPDATE "administrative" SET "force_txt_file_ext" = "False"')137 update_version = dict(id=1, version="16", os=running_platform)138 db_version.update(update_version, ['id'])139 if db_version_dict['version'] == '16':140 database_connection.query("alter table 'folders' add column 'invoice_date_offset'")141 database_connection.query('UPDATE "folders" SET "invoice_date_offset" = 0')142 database_connection.query("alter table 'administrative' add column 'invoice_date_offset'")143 database_connection.query('UPDATE "administrative" SET "invoice_date_offset" = 0')144 update_version = dict(id=1, version="17", os=running_platform)145 db_version.update(update_version, ['id'])146 if db_version_dict['version'] == '17':147 database_connection.query("alter table 'settings' add column 'odbc_driver'")148 database_connection.query('UPDATE "settings" SET "odbc_driver" = "Select ODBC Driver..."')149 database_connection.query("alter table 'settings' add column 'as400_username'")150 database_connection.query('UPDATE "settings" SET "as400_username" = ""')151 database_connection.query("alter table 'settings' add column 'as400_password'")152 database_connection.query('UPDATE "settings" SET "as400_password" = ""')153 database_connection.query("alter table 'settings' add column 'as400_address'")154 database_connection.query('UPDATE "settings" SET "as400_address" = ""')155 update_version = dict(id=1, version="18", os=running_platform)156 db_version.update(update_version, ['id'])157 if db_version_dict['version'] == '18':158 database_connection.query("alter table 'folders' add column 'retail_uom'")159 database_connection.query('UPDATE "folders" SET "retail_uom" = 0')160 database_connection.query("alter table 'administrative' add column 'retail_uom'")161 database_connection.query('UPDATE "administrative" SET "retail_uom" = 0')162 update_version = dict(id=1, version="19", os=running_platform)163 db_version.update(update_version, ['id'])164 if db_version_dict['version'] == '19':165 database_connection.query("alter table 'folders' add column 'force_each_upc'")166 database_connection.query('UPDATE "folders" SET "force_each_upc" = 0')167 database_connection.query("alter table 'administrative' add column 'force_each_upc'")168 database_connection.query('UPDATE "administrative" SET "force_each_upc" = 0')169 update_version = dict(id=1, version="20", os=running_platform)170 db_version.update(update_version, ['id'])171 if db_version_dict['version'] == '20':172 database_connection.query("alter table 'folders' add column 'include_item_numbers'")173 database_connection.query('UPDATE "folders" SET "include_item_numbers" = 0')174 database_connection.query("alter table 'administrative' add column 'include_item_numbers'")175 database_connection.query('UPDATE "administrative" SET "include_item_numbers" = 0')176 update_version = dict(id=1, version="21", os=running_platform)177 db_version.update(update_version, ['id'])178 if db_version_dict['version'] == '21':179 try:180 database_connection.query("alter table 'folders' add column 'include_item_description'")181 database_connection.query('UPDATE "folders" SET "include_item_description" = 0')182 except sqlalchemy.exc.OperationalError:183 pass184 database_connection.query("alter table 'administrative' add column 'include_item_description'")185 database_connection.query('UPDATE "administrative" SET "include_item_description" = 0')186 update_version = dict(id=1, version="22", os=running_platform)187 db_version.update(update_version, ['id'])188 if db_version_dict['version'] == '22':189 try:190 database_connection.query("alter table 'folders' add column 'simple_csv_sort_order'")191 database_connection.query('UPDATE "folders" SET "simple_csv_sort_order" = "upc_number,qty_of_units,unit_cost,description,vendor_item"')192 except sqlalchemy.exc.OperationalError:193 pass194 database_connection.query("alter table 'administrative' add column 'simple_csv_sort_order'")195 database_connection.query('UPDATE "administrative" SET "simple_csv_sort_order" = "upc_number,qty_of_units,unit_cost,description,vendor_item"')196 update_version = dict(id=1, version="23", os=running_platform)...

Full Screen

Full Screen

update_project_version.py

Source:update_project_version.py Github

copy

Full Screen

...6"""7import os8import re9from debian import debfile10def update_version(filename, pattern, repl):11 """Update version data in file."""12 file_content = []13 updated = None14 pattern = re.compile(pattern)15 with open(filename) as fp:16 for line in fp:17 if pattern.match(line):18 oldline = line19 line = pattern.sub(repl, line)20 updated = line != oldline21 file_content.append(line)22 assert updated is not None23 if updated:24 with open(filename, 'w') as fp:25 fp.write(''.join(file_content))26def main():27 """Main routine."""28 # detect debian version29 with open('debian/changelog') as fp:30 debfile_data = debfile.Changelog(fp.read())31 release = str(debfile_data.version)32 version = release.split('~')[0]33 py_version = release34 # fix version for Python package (PEP 440)35 if '~' in py_version:36 py_version = py_version.replace('~', '.')37 try:38 int(py_version[-1])39 except ValueError:40 py_version += '0'41 debfile_year = int(debfile_data.date.split(' ')[3])42 copyright = '2016-{}, Cybernetica AS'.format(debfile_year)43 update_version("setup.py",44 r"( +version=').+(',.*)", "\\g<1>%s\\2" % py_version)45 update_version("collector-admin/ivxv_admin/__init__.py",46 r"(__version__ = ').+(')", "\\g<1>%s\\2" % py_version)47 update_version("collector-admin/ivxv_admin/__init__.py",48 r"(DEB_PKG_VERSION = ').+(')", "\\g<1>%s\\2" % release)49 update_version("common/java/common-build.gradle",50 "^(version ').+('.*)", "\\g<1>%s\\2" % release)51 update_version("tests/features/steps/__init__.py",52 r"(DEB_VERSION = ').+(')", "\\g<1>%s\\2" % release)53 update_version("collector-admin/site/ivxv/about.html",54 r'(.+id="version">).+(<)', '\\g<1>%s\\2' % release)55 update_version("Documentation/documents.py",56 r"^(release *= *').+('.*)", "\\g<1>%s\\2" % release)57 update_version("Documentation/documents.py",58 r"^(copyright *= *').+('.*)", "\\g<1>%s\\2" % copyright)59 update_version("Documentation/et/seadistuste_koostejuhend/mixnet.rst",60 r"(.*ivxv-verificatum-).+(-runner.zip)", "\\g<1>%s\\2" % release)61 update_version('tests/templates/test-report/conf.py',62 "^(version *= *').+('.*)", "\\g<1>%s\\2" % version)63 update_version('tests/templates/test-report/conf.py',64 "^(release *= *').+('.*)", "\\g<1>%s\\2" % release)65 update_version("Documentation/et/audiitor/audit.rst",66 r"^(.*(auditor|key|processor)-).+(.zip)", "\\g<1>%s\\3" % release)67if __name__ == '__main__':...

Full Screen

Full Screen

update-version.py

Source:update-version.py Github

copy

Full Screen

1#!/usr/bin/env python2import sys3def update_version(path, strict=False, update_series=False):4 ver = version5 with open(path, "rb") as f:6 data = f.read()7 if strict:8 # only use the first three components9 parts = ver.split(".")10 parts = parts[:3]11 for i, part in enumerate(parts):12 p = ""13 for c in part:14 if c in "0123456789":15 p += c16 else:17 break18 parts[i] = p19 ver = '.'.join(parts)20 data = data.replace("9.8.7", ver)21 if update_series:22 data = data.replace("unknown", series)23 with open(path, "wb") as f:24 f.write(data)25with open("VERSION", "rb") as f:26 version = f.read().strip()27with open("SERIES", "rb") as f:28 series = f.read().strip()29if len(sys.argv) > 1:30 update_version(sys.argv[1], update_series=("--update-series" in sys.argv))31else:32 update_version("README")33 update_version("common.mk")34 update_version("fs-uae.spec")35 update_version("debian/changelog")36 update_version("server/debian/changelog")37 update_version("server/setup.py")38 update_version("launcher/setup.py")39 update_version("launcher/setup_py2exe.py")40 update_version("launcher/setup_py2app.py", strict=True)41 update_version("launcher/debian/changelog")42 update_version("launcher/fs_uae_launcher/Version.py", update_series=True)43 update_version("src/fs-uae/version.c")44 update_version("macosx/template/Contents/Info.plist", strict=True)...

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