When I had tested code which had called
sys.exit(), my usual approach was to use mock:
with mock.patch.object(mymodule.sys, "exit") as mock_exit:
assert mock_exit.call_args == 42
This will be a quick story on how to install the ML-agent environment and run the 3DBall example of the unity ML-agents github repo. I wanted to start trying my hands at reinforcement learning and figured the ML-agents repo of Unity was a good place to start.