Fix setup.py.RunTests.run() to return proper exit code.

The previous situation didn't fail on Travis-CI.

But this does, so I had to include also a number of fixes for revealed
issues.

Fixing #314, #315, #316, and #317