Bring tests into fully passing state on py3.12. Please see individual patches for details.
/cc @Daetalus, @jerome, @tomo