Tests cleanups, Use tempfile.mkdtemp to create temp dirs for tests

I prefer to have test dirs below /tmp which is a tmpfs on most Debian
installations.

All tests include the context module which consolidates tmpdir creation
and cleanup, undoes a chdir in teardown and silences log messages.
remove deprecated method _git_getoutput and update all usages
redirect stdout to sys.stdout in command_wrappers

Thus nosetest will capture the output of failed tests (only) and
show it together with failed tests.
Before that, output was mixed with the progress points or letters
of the testrunner.
add expected stdout to doctests