Account for Python 3.7 in the 7.4.x branch

This commit is contained in:
Bruno Oliveira 2023-09-07 10:06:11 -03:00
parent 3dc0657347
commit 189fcb7ac6
2 changed files with 6 additions and 1 deletions

View File

@ -545,7 +545,9 @@ class DoctestModule(Module):
Here we override `_from_module` to check the underlying
function instead. https://github.com/python/cpython/issues/107995
"""
if isinstance(object, functools.cached_property):
if hasattr(functools, "cached_property") and isinstance(
object, functools.cached_property
):
object = object.func
# Type ignored because this is a private function.

View File

@ -482,6 +482,9 @@ class TestDoctests:
reprec = pytester.inline_run(p, "--doctest-modules")
reprec.assertoutcome(failed=1)
@pytest.mark.skipif(
sys.version_info[:2] <= (3, 7), reason="Only Python 3.7 or less"
)
def test_doctest_cached_property(self, pytester: Pytester):
p = pytester.makepyfile(
"""