Fix new Python 3.12-related test failures
Several tests need rewrites/updates to account for removals in Python 3.12 (as of CPython 3.12.0b2).
I'd thrown together workarounds for an earlier 3.12 pre-release and got nearly everything passing again, but needs a little more focused attention with proper fixes, now that CPython 3.12 is theoretically feature-complete.
__________________________________________________________ ERROR collecting testing/cffi0/test_zdistutils.py __________________________________________________________
ImportError while importing test module '/cffi-mirror/testing/cffi0/test_zdistutils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
testing/cffi0/test_zdistutils.py:1: in <module>
import sys, os, imp, math, shutil
E ModuleNotFoundError: No module named 'imp'
___________________________________________________ ERROR collecting testing/cffi1/test_dlopen_unicode_literals.py ____________________________________________________
testing/cffi1/test_dlopen_unicode_literals.py:9: in <module>
exec(py.code.compile(s))
E AttributeError: module 'py' has no attribute 'code'
__________________________________________________________ ERROR collecting testing/cffi1/test_new_ffi_1.py ___________________________________________________________
ImportError while importing test module '/cffi-mirror/testing/cffi1/test_new_ffi_1.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
testing/cffi1/test_new_ffi_1.py:3: in <module>
import platform, imp
E ModuleNotFoundError: No module named 'imp'
_________________________________________________________ ERROR collecting testing/cffi1/test_parse_c_type.py _________________________________________________________
ImportError while importing test module '/cffi-mirror/testing/cffi1/test_parse_c_type.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.12/importlib/__init__.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
testing/cffi1/test_parse_c_type.py:26: in <module>
lib = ffi.verify(
cffi/api.py:467: in verify
self.verifier = Verifier(self, source, tmpdir, **kwargs)
cffi/verifier.py:43: in __init__
vengine_class = _locate_engine_class(ffi, force_generic_engine)
cffi/verifier.py:240: in _locate_engine_class
from . import vengine_cpy
cffi/vengine_cpy.py:4: in <module>
import sys, imp
E ModuleNotFoundError: No module named 'imp'
==================================================