I need the python.exe exit code to detect if our unit test suite has failed.But propy.bat (ArcGIS Pro 2.1) does not preserve the exit code from python.exe.
Any ideas for a workaround - or could we maybe see it fixed in a coming release?
Perhaps run your test suite in the arcgispro-py3 conda env (eg using proenv.bat) and call python directly rather than calling propy.bat.
In propy.bat, try replacing the following
python.exe %*@call %deactivate_path%
python.exe %*@set pythonerror=%errorlevel%@call %deactivate_path%exit /b %pythonerror%
Retrieving data ...