Extracted mechanism for calling python in a testenv, and fixed the startup integration test to shut down the server when finished