Write str instead of bytes also for stdout of type io.TextIOBase
xmlrunner replaces stdout with a subclass of io.TextIOBase. Just checking for io.StringIO (another subclass of io.TextIOBase) doesn't help.
This should fix the problems seen on CI in the unit tests of craft-blueprints-kde, e.g. https://invent.kde.org/packaging/craft-blueprints-kde/-/jobs/1121914/