Esri / military-tools-geoprocessing-toolbox

military-tools-geoprocessing-toolbox is a collection of models, scripts, and tools for use in ArcGIS for Desktop and ArcGIS Pro. This toolbox is one component that is a part of Military Tools.
Apache License 2.0
33 stars 14 forks source link

Running tests on Pro 1.3/Conda environment #54

Open mfunk opened 8 years ago

mfunk commented 8 years ago

So in recent builds of Pro the Python development environment has changed. There is no longer a separate install for Python for Pro, like there is for 1.2 and earlier. Instead a Python environment is installed with Pro 1.3. This will be a challenge as we cannot run scripts using python script.py or as py -3.4 script.py. Instead we have to use...

"C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy" runme.py

So I see a few challenges here. 1) Will Pro always be installed on C:\? 2) How can we switch to testing Pro 1.2 or any version of Desktop (as they don't have this call available)?

csmoore commented 8 years ago

There is no guarantee that Pro will be at a set install location (ex. if the user choses the local user-only install option).

But I think it is fine if TestKickStart.bat assumes the default location and then let's the user change this in the script if they don't have it installed at that default location.

I believe the windows python launcher (py -2.7/3.4) actually gets installed with Python 3 so you may have to change the 2.7 launch code also.

mfunk commented 8 years ago

Yeah, I assumed that 1) would be a no. For 2) the py.exe is only installed with Python 3. The TestKickStart.bat says if you are using only ONE version then comment the above stuff and uncomment the line for "python testrunner.py" or something to that effect. The problem is now we have to check which version of Pro is installed and then choose:

Or come up with something different.

mfunk commented 8 years ago

So the temporary solution to not having propy.bat is to modify the TestKickStart.bat to call the EXEs directly:

ECHO Python 3.4 Tests ===============================
REM py -3.4 TestRunner.py %LOG%
"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" TestRunner.py %LOG%

ECHO Python 2.7 Tests ===============================
REM py -2.7 TestRunner.py %LOG%
python TestRunner.py %LOG%

Again, I don't like this because we are assuming that Pro is installed in C:\Program Files\ArcGIS\Pro.

csmoore commented 8 years ago

For a developer-focused script like this I think it is fine to have it set to the default location - so long as it is easy to change (and you get a meaningful error if not there).

For example, this is done in the register script (and many other places such as the Pro solutions/project): https://github.com/Esri/military-tools-for-arcgis/blob/dev/source/MilitaryToolsToolbar/ArcGISProAddinMAToolbar/InstallMilitaryToolsFoArcGISPro.bat#L4