Convert run_tests script to Python (#168)