New implementation for doctest bugfix again for systems without any display already fixed in f41a113131

@yomguy could you please check if this new fix is realy ok for systems without any display