In preparation for merging in at least 1 outdated test into the new modifiers suite, and strengthening the existing coverage, we need to start validating that the mesh geometry is valid by calling mesh.validate (aka. BKE_mesh_validate)
While working on this change it's already caught a problem with Bevel (T74800) and a similar unreported issue with Weld (both had vertex weights > 1.0 and in the case of Weld it was 2.0). The fix for 74800 seems to have fixed both so this change can now proceed.
This patch also forces the python output to be flushed after each call. This is necessary in general so that python and blender output appear in the correct order during the test.
Tested locally with Debug and RelWithDebInfo configurations.