Tests: allow custom stream when running tests

I need this last bit to gracefully run tests from another script for generating attribute coverage for the docs.

I know that there are slicker solutions than passing the stream around everywhere, but it is a minimally perturbing solution. The testall script might benefit from a rewrite, but I leave that for a later time.