Convert tests on stderr to use Capture context manager.