移动test文件到test目录
This commit is contained in:
parent
b93e279fd6
commit
822e18e6a5
|
@ -452,7 +452,7 @@ class SdeSynchronous:
|
||||||
def fc2fc(self, fc_name, out, fc_cur, expression, fc_type):
|
def fc2fc(self, fc_name, out, fc_cur, expression, fc_type):
|
||||||
"""启动python子进程输出feature或者table到gdb"""
|
"""启动python子进程输出feature或者table到gdb"""
|
||||||
python_path = str(self.config.python_path() + u' ').encode('gb2312')
|
python_path = str(self.config.python_path() + u' ').encode('gb2312')
|
||||||
script = str(u'sde_fc2fc.py ').encode('gb2312')
|
script = str(self.config.pathname + '\\sde_fc2fc.py ')
|
||||||
src_sde = str(self.src_sde + ' ')
|
src_sde = str(self.src_sde + ' ')
|
||||||
type_cmd = str(fc_type + u' ').encode('gb2312')
|
type_cmd = str(fc_type + u' ').encode('gb2312')
|
||||||
fc_name_cmd = str(fc_name + u' ').encode('gb2312')
|
fc_name_cmd = str(fc_name + u' ').encode('gb2312')
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
import unittest
|
import unittest
|
||||||
|
from imp import reload
|
||||||
from functions import *
|
from functions import *
|
||||||
|
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding('utf8')
|
||||||
|
parent_path = os.path.abspath(os.path.dirname(os.getcwd()))
|
||||||
|
|
||||||
|
|
||||||
class TestFunctions(unittest.TestCase):
|
class TestFunctions(unittest.TestCase):
|
||||||
def test_run_command(self):
|
def test_run_command(self):
|
||||||
python_path = str(u'C:/Python27/ArcGIS10.2/python.exe ').encode('gb2312')
|
python_path = str(u'C:/Python27/ArcGIS10.2/python.exe ').encode('gb2312')
|
||||||
script = str(u'sde_fc2fc.py ').encode('gb2312')
|
script = str(parent_path + '\\sde_fc2fc.py ')
|
||||||
type_cmd = str(u'feature ').encode('gb2312')
|
type_cmd = str(u'feature ').encode('gb2312')
|
||||||
fc_name_cmd = str(u'Building_A ').encode('gb2312')
|
fc_name_cmd = str(u'Building_A ').encode('gb2312')
|
||||||
out_cmd = str(u'Building_A ').encode('gb2312')
|
out_cmd = str(u'Building_A ').encode('gb2312')
|
|
@ -1,18 +1,22 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
import unittest
|
import unittest
|
||||||
import inspect
|
import inspect
|
||||||
|
from imp import reload
|
||||||
|
|
||||||
import arcpy
|
import arcpy
|
||||||
from functions import *
|
from functions import *
|
||||||
from sys_config import SysConfig
|
from sys_config import SysConfig
|
||||||
from logger import Logger
|
from logger import Logger
|
||||||
from sde_sync import SdeSynchronous
|
from sde_sync import SdeSynchronous
|
||||||
|
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding('utf8')
|
||||||
|
|
||||||
|
|
||||||
class TestSdeSynchronous(unittest.TestCase):
|
class TestSdeSynchronous(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# 获取当前路径
|
# 获取当前路径的父级路径
|
||||||
caller_file = inspect.getfile(inspect.currentframe())
|
work_pathname = os.path.abspath(os.path.dirname(os.getcwd()))
|
||||||
work_pathname = os.path.abspath(os.path.dirname(caller_file))
|
|
||||||
# 同步开始时间
|
# 同步开始时间
|
||||||
curr_sync_date = time.strftime("%Y-%m-%d", time.localtime())
|
curr_sync_date = time.strftime("%Y-%m-%d", time.localtime())
|
||||||
curr_sync_time = time.strftime("%H-%M-%S", time.localtime())
|
curr_sync_time = time.strftime("%H-%M-%S", time.localtime())
|
||||||
|
@ -27,7 +31,7 @@ class TestSdeSynchronous(unittest.TestCase):
|
||||||
logger.log("==SdeSynchronous Started==")
|
logger.log("==SdeSynchronous Started==")
|
||||||
logger.log("Process begin at " + str(curr_sync_date) + " " + str(curr_sync_time) + ".")
|
logger.log("Process begin at " + str(curr_sync_date) + " " + str(curr_sync_time) + ".")
|
||||||
self.sde_db_sync = SdeSynchronous(config, logger)
|
self.sde_db_sync = SdeSynchronous(config, logger)
|
||||||
self.sde_db_sync.src_sde = self.sde_db_sync.get_connection(str(u"源库SDE连接").encode('gb2312'))
|
self.sde_db_sync.src_sde = self.sde_db_sync.get_connection(str(u"源库SDE连接"))
|
||||||
arcpy.env.workspace = self.sde_db_sync.src_sde
|
arcpy.env.workspace = self.sde_db_sync.src_sde
|
||||||
self.sde_db_sync.config.last_sync_datetime = self.sde_db_sync.get_last_sync_datetime()
|
self.sde_db_sync.config.last_sync_datetime = self.sde_db_sync.get_last_sync_datetime()
|
||||||
self.edit = self.sde_db_sync.start_edit()
|
self.edit = self.sde_db_sync.start_edit()
|
Loading…
Reference in New Issue