# coding=utf-8 import unittest from imp import reload from functions import * reload(sys) sys.setdefaultencoding('utf8') parent_path = os.path.abspath(os.path.dirname(os.getcwd())) class TestFunctions(unittest.TestCase): def test_run_command(self): python_path = str(u'C:/Python27/ArcGIS10.2/python.exe ').encode('gb2312') script = str(parent_path + '\\sde_fc2fc.py ') type_cmd = str(u'feature ').encode('gb2312') fc_name_cmd = str(u'Building_A ').encode('gb2312') out_cmd = str(u'Building_A ').encode('gb2312') fc_cur_cmd = str(u'Building_A ').encode('gb2312') # exp_cmd = str(u'"" ') command_string = python_path + script + type_cmd + fc_name_cmd + out_cmd + fc_cur_cmd rst, out = run_command(command_string) print(out) self.assertEqual(rst, True)