Convert tests/test_stats.py to use Harness & TestClient.

Relates to #540.