From 15ddccf700ad1318c083eeb543f1c1a419dd1e96 Mon Sep 17 00:00:00 2001 From: Elijah DeLee Date: Fri, 4 Feb 2022 16:06:32 -0500 Subject: [PATCH] importlib.readers not valid until python 3.10 This exists https://github.com/python/cpython/blob/3.10/Lib/importlib/readers.py and FileReader is in there This is a 404 https://github.com/python/cpython/blob/3.9/Lib/importlib/readers.py This change needs to get backported to the 7.0.z branch(s) too Fixes https://github.com/pytest-dev/pytest/issues/9608 --- src/_pytest/assertion/rewrite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index f0922870a4..cc11e1d16a 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -273,7 +273,7 @@ def get_data(self, pathname: Union[str, bytes]) -> bytes: with open(pathname, "rb") as f: return f.read() - if sys.version_info >= (3, 9): + if sys.version_info >= (3, 10): def get_resource_reader(self, name: str) -> importlib.abc.TraversableResources: # type: ignore from types import SimpleNamespace