Skip to content

Commit

Permalink
Merge pull request #312 from mfunk/master
Browse files Browse the repository at this point in the history
Merging dev to master for v2.1.0
  • Loading branch information
mfunk committed Sep 17, 2015
2 parents ea42521 + 1cf5bd2 commit ab23e47
Show file tree
Hide file tree
Showing 659 changed files with 8,765 additions and 1,706 deletions.
13 changes: 11 additions & 2 deletions build.xml
Expand Up @@ -52,7 +52,7 @@
</target>

<target name="get_data_management_data">
<!-- Adjust Sample Data Dates Tools Test Data -->
<!-- Adjust Sample Data Dates Tools Test Data ... DATA NOT NEEDED FOR THIS TEST -->

<!-- Position Analysis Tools Test Data: 130f52ac95a040cb80717d99db100409 -->
<echo message="Downloading Position Analysis Tools test data." />
Expand Down Expand Up @@ -177,7 +177,16 @@
</target>

<target name="get_visibility_data">
<!-- Sun Position Analysis Tools Test Data -->

<!-- Sun Position Analysis Tools Test Data: bf6a04b4c9a3447b91e9c0b4074ca1e4 -->
<echo message="Downloading Sun Position Analysis Tools test data" />
<get src="http://www.arcgis.com/sharing/content/items/bf6a04b4c9a3447b91e9c0b4074ca1e4/data"
dest="${dir.zipdir}/test_sun_position.gdb.zip"
verbose="true"
usetimestamp="true" />
<echo message="Unzipping Sun Position Analysis Tools test dat" />
<unzip src="${dir.zipdir}/test_sun_position.gdb.zip"
dest="${dir.visibilitydatadir}/geodatabases" />

<!-- Visibility And Range Tools Test Data: 62d971c064e043f48aee2fff9c701042 -->
<echo message="Downloading Visibility And Range Tools test data" />
Expand Down
81 changes: 42 additions & 39 deletions capability/test/test_poo_tools/TemplateConfigTest.py
@@ -1,4 +1,4 @@
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Copyright 2015 Esri
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# TemplateConfigTest.py
# Description: Common objects/methods used by test scripts
# Requirements: ArcGIS Desktop Standard
Expand All @@ -25,44 +25,46 @@
import TestUtilities

try:
print "Testing ArcPy"
print("Testing ArcPy")
arcpy.AddMessage("ArcPy works")
print "Testing Necessary Paths"
print "Running from: " + str(TestUtilities.currentPath)

print("Testing Necessary Paths")

print("Running from: " + str(TestUtilities.currentPath))

paths2Check = []
paths2Check.extend([TestUtilities.toolboxesPath, TestUtilities.toolDataPath, TestUtilities.layerPath,TestUtilities.testDataPath])

for path2check in paths2Check :
if os.path.exists(path2check) :
print "Valid Path: " + path2check
else :
print "ERROR: Necessary Path not found: " + path2check
paths2Check.extend([TestUtilities.toolboxesPath, TestUtilities.toolDataPath,
TestUtilities.layerPath, TestUtilities.testDataPath])

for path2check in paths2Check:
if os.path.exists(path2check):
print("Valid Path: " + path2check)
else:
print("ERROR: Necessary Path not found: " + path2check)
raise Exception('Bad Path')
print "Testing Necessary Geo Objects"

print("Testing Necessary Geo Objects")

objects2Check = []
objects2Check.extend([TestUtilities.toolDataGDB, TestUtilities.toolbox,TestUtilities.testDataGDB])
for object2Check in objects2Check :
objects2Check.extend([TestUtilities.toolDataGDB, TestUtilities.toolbox,
TestUtilities.testDataGDB])
for object2Check in objects2Check:
desc = arcpy.Describe(object2Check)
if desc == None :
print "--> Invalid Object: " + str(object2Check)
if desc is None:
print("--> Invalid Object: " + str(object2Check))
arcpy.AddError("Bad Input")
raise Exception('Bad Input')
else :
print "Valid Object: " + desc.Name
print "Test Successful"
except arcpy.ExecuteError:
# Get the arcpy error messages
msgs = arcpy.GetMessages()
arcpy.AddError(msgs)
print msgs
else:
print("Valid Object: " + desc.Name)

print("Test Successful")

except arcpy.ExecuteError:
# Get the arcpy error messages
msgs = arcpy.GetMessages()
arcpy.AddError(msgs)
print(msgs)

# return a system error code
sys.exit(-1)

Expand All @@ -72,16 +74,17 @@
tbinfo = traceback.format_tb(tb)[0]

# Concatenate information together concerning the error into a message string
pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + \
"\nError Info:\n" + str(sys.exc_info()[1])
msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n"

# Return python error messages for use in script tool or Python Window
arcpy.AddError(pymsg)
arcpy.AddError(msgs)

# Print Python error messages for use in Python / Python Window
print pymsg + "\n"
print msgs
# return a system error code
sys.exit(-1)
print(pymsg + "\n")
print(msgs)

# return a system error code
sys.exit(-1)
10 changes: 5 additions & 5 deletions capability/test/test_poo_tools/TestPointOfOrigin.py
Expand Up @@ -33,26 +33,26 @@ class LicenseError(Exception):

def main():
''' main test method '''
try:
try:
arcpy.ImportToolbox(TestUtilities.toolbox)
arcpy.env.overwriteOutput = True

# Set tool param variables
inputImpactPoints = os.path.join(TestUtilities.testDataGDB, "impacts")
inputImpactPoints = os.path.join(TestUtilities.testDataGDB, "impact_pts_monterey_UTM10N")
inputWeaponsTable = os.path.join(TestUtilities.toolDataGDB, r"Weapons")
inModelField = 'Model'
inMinRangeField = 'Minimum_range'
inMaxRangeField = 'Maximum_range'
inputWeaponsAsString = ("'82mm Soviet Mortar';'88mm American Mortar';'120mm American Mortar'")
inputWeaponsAsString = ("'M120/121 120-mm American Mortar';'M224 60-mm American Mortar';'M252 81-mm American Mortar'")
print("inputWeaponsAsString: " + str(inputWeaponsAsString))
inputWeaponsAsList = inputWeaponsAsString.split(";")
print("inputWeaponsAsList: " + str(inputWeaponsAsList))
outputWorkspace = arcpy.env.scratchGDB
outImpactPrefix = r"imp"
outPooPrefix = r"poo"
outRangePrefix = r"rng"
# WGS_1984_UTM_Zone_42N using factoryCode
sr = arcpy.SpatialReference(32642)
# WGS_1984_UTM_Zone_10N using factoryCode
sr = arcpy.SpatialReference(32610)

# Testing Point Of Origin Site Detection
arcpy.AddMessage("Starting Test: Point of Origin Site Detection")
Expand Down
16 changes: 7 additions & 9 deletions capability/test/test_poo_tools/TestUtilities.py
@@ -1,4 +1,4 @@
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Copyright 2015 Esri
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,21 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# TestUtilities.py
# Description: Common objects/methods used by test scripts
# Requirements: ArcGIS Desktop Standard
# ----------------------------------------------------------------------------

import arcpy
import os
import sys

currentPath = os.path.dirname(__file__)
toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../capability/toolboxes/"))
testDataPath = os.path.normpath(os.path.join(currentPath,r"../../../capability/data/geodatabases/"))
toolDataPath = os.path.join(toolboxesPath,r"tooldata")
layerPath = os.path.join(toolboxesPath, "layers")
testDataPath = os.path.normpath(os.path.join(currentPath, r"../../../capability/data/geodatabases/"))
toolDataPath = os.path.join(toolboxesPath, r"tooldata")
layerPath = os.path.join(toolboxesPath, "layers")
toolDataGDB = os.path.join(toolDataPath, "PointOfOrigin.gdb")
testDataGDB = os.path.join(testDataPath,"test_poo_tools.gdb")
toolbox = os.path.join(toolboxesPath, "Point Of Origin Tools_10.3.tbx")
testDataGDB = os.path.join(testDataPath, "test_poo_tools.gdb")
toolbox = os.path.join(toolboxesPath, "Point Of Origin Tools_10.3.tbx")
Binary file modified capability/toolboxes/Point Of Origin Tools_10.3.tbx
Binary file not shown.

0 comments on commit ab23e47

Please sign in to comment.