> I was trying to avoid the case of calling git config every time by using the static variable DEFAULT_BUILD_COMMAND. The variable is initialized to None and assigned a non None value by check_output.

The way I read the code is that if the configuration value is unset, then `git config` fails, and the exception handler in `get_default_test_command()` causes it to return `None`.  So `DEFAULT_BUILD_COMMAND` is set to `None` again, and every time it is queried the whole sequence is repeated.

I think you need a way to distinguish "command hasn't been checked yet; we don't know what it is" from "command has been checked but it was not set"; either an additional boolean variable that keeps track of whether you have tried to read the command already, or maybe store another value (`False`?) to the variable to distinguish it from `None`.