How to use g_importer method in autotest

Best Python code snippet using autotest_python

mock.py

Source:mock.py Github

copy

Full Screen

...1188 arguments will be applied to *all* patches done by `patch.multiple`.1189 When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX`1190 for choosing which methods to wrap.1191 """1192 def g_importer():1193 return _importer(target)1194 def g_target():1195 return target1196 if type(target) in (unicode, str):1197 getter = g_importer1198 else:1199 getter = g_target1200 if not kwargs:1201 raise ValueError(1202 'Must supply at least one keyword argument with patch.multiple'1203 )1204 # need to wrap in a list for python 3, where items is a view1205 items = list(kwargs.items())1206 attribute, new = items[0]...

Full Screen

Full Screen

Transfer.py

Source:Transfer.py Github

copy

Full Screen

1#!/usr/bin/env python2# -*- coding: utf-8 -*-3import pudb4import datetime5import argparse6import time7from taxamerger.TaxonomiesMerger import TaxonomiesMerger8from CopyResultDB import CopyResultDB9from runSolrIndexer import runSolrIndexer10from GlobalConfig import ConfigReader11from TempDB import TempDB12from lib.logTransfer import TransferLog13from DBConnectors.MSSQLConnector import MSSQLConnector14from lib.Datasources import Datasources15from lib.SpecimenTransfer.DCGetter import DCGetter16from lib.SpecimenTransfer.DCSpecimenGetter import DCSpecimenGetter17from lib.SpecimenTransfer.InsertSpecimen import InsertSpecimen18from lib.SpecimenTransfer.DCProjectGetter import DCProjectGetter19from lib.SpecimenTransfer.InsertProject import InsertProject20from lib.SpecimenTransfer.DCProjectUserGetter import DCProjectUserGetter21from lib.SpecimenTransfer.InsertProjectUser import InsertProjectUser22from lib.SpecimenTransfer.DCCollectionProjectGetter import DCCollectionProjectGetter23from lib.SpecimenTransfer.InsertCollectionProject import InsertCollectionProject24from lib.SpecimenTransfer.DCInstituteGetter import DCInstituteGetter25from lib.SpecimenTransfer.InsertInstitute import InsertInstitute26from lib.SpecimenTransfer.DCSpecimenDataGetter import DCSpecimenDataGetter27from lib.SpecimenTransfer.InsertSpecimenData import InsertSpecimenData28from lib.SpecimenTransfer.DCMediaGetter import DCMediaGetter29from lib.SpecimenTransfer.InsertMedia import InsertMedia30from lib.SpecimenTransfer.DCGeoGetter import DCGeoGetter31from lib.SpecimenTransfer.InsertGeo import InsertGeo32from lib.SpecimenTransfer.DCBarcodeGetter import DCBarcodeGetter33from lib.SpecimenTransfer.InsertBarcode import InsertBarcode34from lib.SpecimenTransfer.DCBarcodeReadsGetter import DCBarcodeReadsGetter35from lib.SpecimenTransfer.InsertBarcodeReads import InsertBarcodeReads36from lib.TaxaMatcher.TaxaMatcher import TaxaMatcher37from lib.CopyMatchedTaxa.CopyMatchedTaxa import CopyMatchedTaxa38from lib.CopyMatchedTaxa.CopyCommonNamesToTargetTable import CopyCommonNamesToTargetTable39from lib.CopyMatchedTaxa.CopyRedListToTargetTable import CopyRedListToTargetTable40from lib.CopyMatchedTaxa.CopyTaxonomySources import CopyTaxonomySources41from lib.CopyMatchedTaxa.CopyTaxonomicRanksEnum import CopyTaxonomicRanksEnum42from lib.CopyMatchedTaxa.NestedSetGenerator import NestedSetGenerator43from lib.CopyMatchedTaxa.FlatTaxaTable import FlatTaxaTable44from lib.Statistics.CalculateStatistics import CalculateStatistics45from lib.Statistics.SpecimenCompleteness import SpecimenCompleteness46import pudb47from configparser import ConfigParser48config = ConfigParser()49config.read('config.ini')50import logging, logging.config51if __name__ == "__main__":52 logging.config.fileConfig('config.ini', defaults={'logfilename': 'sync_dwb2portal.log'}, disable_existing_loggers=False)53logger = logging.getLogger('sync_webportal')54if __name__ == "__main__":55 usage = "Transfer.py [--skip taxamerger]"56 parser = argparse.ArgumentParser(prog="Transfer.py", usage=usage, description='Arguments for Transfer.py')57 parser.add_argument('--skip', metavar = 'taxamerger')58 args = parser.parse_args()59 60 61 logger.info("\n\n======= S t a r t - {:%Y-%m-%d %H:%M:%S} ======".format(datetime.datetime.now()))62 63 globalconfig = ConfigReader(config)64 65 if args.skip == 'taxamerger':66 pass67 else:68 taxonomiesmerger = TaxonomiesMerger(globalconfig)69 taxonomiesmerger.mergeTaxonomies()70 71 72 tempdb = TempDB(globalconfig)73 transfer_log = TransferLog(globalconfig)74 transfer_log.start()75 76 for datasource in globalconfig.data_sources:77 78 #time.sleep(60)79 80 datasourcename = datasource.data_source_name81 dstable = Datasources(globalconfig)82 dstable.addDatasource(datasourcename)83 datasourceid = dstable.getDatasourceID(datasourcename)84 85 dc_db = MSSQLConnector(connectionstring=datasource.source_database)86 87 dcgetter = DCGetter(dc_db, datasourcename, globalconfig, datasourceid)88 dcgetter.create_transfer_ids_temptable()89 90 logger.info("Transfer Specimens {0}".format(datasourcename.upper()))91 sp_getter = DCSpecimenGetter(dc_db, datasourcename, globalconfig, datasourceid)92 sp_importer = InsertSpecimen(globalconfig, sp_getter)93 94 logger.info("Transfer institutes {0}".format(datasourcename.upper()))95 inst_getter = DCInstituteGetter(dc_db, datasourcename, globalconfig, datasourceid)96 inst_importer = InsertInstitute(globalconfig, inst_getter)97 98 logger.info("Transfer Projects {0}".format(datasourcename.upper()))99 p_getter = DCProjectGetter(dc_db, datasourcename, globalconfig, datasourceid)100 p_importer = InsertProject(globalconfig, p_getter)101 102 logger.info("Transfer ProjectUser {0}".format(datasourcename.upper()))103 pu_getter = DCProjectUserGetter(dc_db, datasourcename, globalconfig, datasourceid)104 pu_importer = InsertProjectUser(globalconfig, pu_getter)105 106 logger.info("Transfer Collection Projects {0}".format(datasourcename.upper()))107 cp_getter = DCCollectionProjectGetter(dc_db, datasourcename, globalconfig, datasourceid)108 cp_importer = InsertCollectionProject(globalconfig, cp_getter)109 110 # import specimen data111 tables = ['specimendata', 'biology', 'event', 'agent', 'part', 'collection']112 for table in tables:113 logger.info("Transfer Specimen Data {0} {1}".format(datasourcename.upper(), table))114 d_getter = DCSpecimenDataGetter(dc_db, datasourcename, globalconfig, table, datasourceid)115 d_importer = InsertSpecimenData(globalconfig, d_getter)116 117 118 logger.info("Transfer Media {0}".format(datasourcename.upper()))119 md_getter = DCMediaGetter(dc_db, datasourcename, globalconfig, datasourceid)120 md_importer = InsertMedia(globalconfig, md_getter)121 122 logger.info("Transfer Coordinates {0}".format(datasourcename.upper()))123 g_getter = DCGeoGetter(dc_db, datasourcename, globalconfig, datasourceid)124 g_importer = InsertGeo(globalconfig, g_getter)125 126 logger.info("Transfer Barcodes {0}".format(datasourcename.upper()))127 b_getter = DCBarcodeGetter(dc_db, datasourcename, globalconfig, datasourceid)128 b_importer = InsertBarcode(globalconfig, b_getter)129 130 logger.info("Transfer Barcode Reads {0}".format(datasourcename.upper()))131 br_getter = DCBarcodeReadsGetter(dc_db, datasourcename, globalconfig, datasourceid)132 br_importer = InsertBarcodeReads(globalconfig, br_getter)133 134 transfer_log.update(datasourcename)135 dc_db.closeConnection()136 137 transfer_log.finished()138 139 taxamatcher = TaxaMatcher(globalconfig)140 141 copytaxa = CopyMatchedTaxa(globalconfig)142 143 copycommonnames = CopyCommonNamesToTargetTable(globalconfig)144 145 copyredlist = CopyRedListToTargetTable(globalconfig)146 147 copytaxonomysources = CopyTaxonomySources(globalconfig)148 149 copytaxranks = CopyTaxonomicRanksEnum(globalconfig)150 151 nestedgen = NestedSetGenerator(globalconfig)152 153 flattaxatable = FlatTaxaTable(globalconfig)154 155 calcstats = CalculateStatistics(globalconfig)156 157 spcompletenes = SpecimenCompleteness(globalconfig)158 159 dbcopy = CopyResultDB(globalconfig)160 dbcopy.copy_db()161 162 runSolrIndexer()...

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