I confirmed the above by changing regrtest as follows in the patch (moving the decorator from load_tests()), and trying both placements of the loadTestsFromModule() line. One gives the warning and one does not:
if test_runner is None:
loader = unittest.TestLoader()
#tests = loader.loadTestsFromModule(the_module)
@support.reap_threads
def test_runner():
try:
tests = loader.loadTestsFromModule(the_module)
support.run_unittest(tests)
finally:
support.reap_children()
test_runner()
This is mostly a suggestion though -- not 100%.