Improve TestConfig.py

Importing this file used to run all the tests immediately. This did not
seem like something an import statement should be doing, so it was moved
into a function.

This led to a re-tab so this commits looks like a nearly full rewrite.
The price we pay to do better.