bpo-41322: Add unit tests for deprecation of test return values (GH-27846)

Also fix the traceback of warnings.
6 files changed