More python3 compatibility

Printing using file= argument to print only worksfor binary files so we
cannot use constructs like print(b'', file=io.BytesIO()) because it
would actually print "b''" on python 3.

Change also the stdout capture in test to use text files.
Status Job ID Name Coverage
  External
failed SLAPOS-EGG-TEST-JEROME-PY3

00:18:45