def setUpClass(cls): tool = PythonTool() parameters = tool.getParameterInfo() params = tool.processParameters(parameters=parameters) cls.params = params buildings_name = params["buildings_name"] out_f = params["connection_folder"] out_n = params["edit_connection_name"] plat = params["platform"] inst = params["instance"] opt = params["opt"] edit_version_name = params["edit_version_name"] # out_folder, out_name, platform, instance, options cls.sde_file = params["gis_gdb"] # opt, out_folder, uid, platform, instance, target_sde, new_name, parent_version cls.manager = Manager(opt=opt, connection_folder=out_f, target_sde=cls.sde_file, new_version=edit_version_name, new_connection=out_n, platform=plat, instance=inst) cls.manager.clean_previous() cls.version_sde = cls.manager.connect_version() env.workspace = cls.version_sde cls.versioned_buildings = tool.get_versioned_fc(env.workspace, buildings_name) cls.edit = da.Editor(cls.version_sde) cls.edit.startEditing()
def setUpClass(cls): tool = PythonTool() parameters = tool.getParameterInfo() params = tool.processParameters(parameters=parameters) out_f = params["connection_folder"] out_n = params["edit_connection_name"] plat = params["platform"] inst = params["instance"] cls.weaver_attributes = params["table_attributes"] edit_version_name = params["edit_version_name"] sql_table = params["sql_table"] gdb_table = params["gdb_table"] gdb_table_name = params["gdb_table_name"] opt = params["opt"] cls.sde_file = params["gis_gdb"] manager = Manager(opt=opt, connection_folder=out_f, target_sde=cls.sde_file, new_version=edit_version_name, new_connection=out_n, platform=plat, instance=inst) manager.clean_previous() cls.version_sde_file = manager.connect_version() result = Tool.compare_tables(sql_table=sql_table, gdb_table=gdb_table) cls.match_fields = result["match_fields"] cls.add_rows = result["add_rows"] cls.exist_rows = result["exist_rows"] cls.folio_ids = result["folioIds"] env.workspace = cls.version_sde_file cls.editor = da.Editor(cls.version_sde_file) cls.version_gdb_table = arcpy.ListTables("*{}*".format(gdb_table_name))[0]
def setUpClass(cls): tool = PythonTool() parameters = tool.getParameterInfo() params = tool.process_parameters(parameters=parameters) cls.out_f = params["connection_folder"] cls.out_n = params["edit_connection_name"] cls.plat = params["platform"] cls.inst = params["instance"] cls.opt = params["opt"] cls.sde_file = params["gis_gdb"] cls.edit_version_name = params["edit_version_name"] cls.params = params
def setUpClass(cls): """out_folder, out_name, platform, instance, options""" tool = PythonTool() parameters = tool.getParameterInfo() params = tool.process_parameters(parameters=parameters) out_folder = params["connection_folder"] out_name = params["edit_connection_name"] plat = params["platform"] inst = params["instance"] opt = params["opt"] connector = Connector(out_f=out_folder, out_name=out_name, platform=plat, instance=inst, options=opt) cls.sde_file = connector.create_sde_connection() cls.params = params
class TestWeaverUpdate(TestCase): def setUp(self): self.tool = PythonTool() def tearDown(self): self.tool = None def test_updateParameters(self): params = self.tool.getParameterInfo() self.assertEquals(15, len(params)) def test_execute(self): params = self.tool.getParameterInfo() result = self.tool.execute(params, '#') self.assertTrue(result)
class TestWeaverUpdate(TestCase): def setUp(self): self.tool = WeaverGDBUpdate() def tearDown(self): self.tool = None def test_processParameters(self): params = self.tool.getParameterInfo() final_params = self.tool.processParameters(params) self.assertEquals(17, len(final_params.keys())) def test_execute(self): params = self.tool.getParameterInfo() result = self.tool.execute(params, '#') self.assertTrue(result)
def setUp(self): self.tool = WeaverGDBUpdate()
from BCAD_NoiseMit_Tools import WeaverGDBUpdate if __name__ == "__main__": tool = WeaverGDBUpdate() params = tool.getParameterInfo() tool.execute(params, "")
import os import logging import datetime from BCAD_NoiseMit_Tools import CARsGDBUpdate, WeaverGDBUpdate logfile = os.path.join(os.path.dirname(os.path.abspath(__file__)), "logs/task_log.txt") logging.basicConfig(filename=logfile, filemode='a', level=30) cars = CARsGDBUpdate() params = cars.getParameterInfo() result = cars.execute(params, "#") if not result: logging.error("{} :: CARsGDBUpdate failed, run geoprocessing tool in ArcMap to debug".format(datetime.datetime.now())) weav = WeaverGDBUpdate() params = weav.getParameterInfo() result = weav.execute(params, "#") if not result: logging.error("{} :: WeaverGDBUpdate failed, run geoprocessing tool in ArcMap to debug".format(datetime.datetime.now()))
def setUp(self): self.tool = PythonTool()
def setUpClass(cls): tool = PythonTool() params = tool.getParameterInfo() processed_params = tool.process_parameters(params) cls.params = processed_params