Tests fail on Python 3.11 due to importlib.resources DeprecationWarning
encukou opened this issue · 1 comments
encukou commented
Tests fail on Python 3.11:
pep517/in_process/__init__.py:14: in _in_proc_script_path
return resources.path(__package__, '_in_process.py')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ('pep517.in_process', '_in_process.py'), kwargs = {}
@functools.wraps(func)
def wrapper(*args, **kwargs):
> warnings.warn(
f"{func.__name__} is deprecated. Use files() instead. "
"Refer to https://importlib-resources.readthedocs.io"
"/en/latest/using.html#migrating-from-legacy for migration advice.",
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
/usr/lib64/python3.11/importlib/resources/_legacy.py:18: DeprecationWarning
encukou commented
The page mentioned in the error message is not helpful, and the current docs don't quite explain a non-deprecated way to get a file using importlib.resources (the Traversable API is not yet documented).
The code suggests a workaround of not using importlib.resources, however: the except
clause works: