Skip to content

Commit 189fcb7

Browse files
committed
Account for Python 3.7 in the 7.4.x branch
1 parent 3dc0657 commit 189fcb7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/_pytest/doctest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,9 @@ def _from_module(self, module, object):
545545
Here we override `_from_module` to check the underlying
546546
function instead. https://github.com/python/cpython/issues/107995
547547
"""
548-
if isinstance(object, functools.cached_property):
548+
if hasattr(functools, "cached_property") and isinstance(
549+
object, functools.cached_property
550+
):
549551
object = object.func
550552

551553
# Type ignored because this is a private function.

testing/test_doctest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ def test_doctestmodule(self, pytester: Pytester):
482482
reprec = pytester.inline_run(p, "--doctest-modules")
483483
reprec.assertoutcome(failed=1)
484484

485+
@pytest.mark.skipif(
486+
sys.version_info[:2] <= (3, 7), reason="Only Python 3.7 or less"
487+
)
485488
def test_doctest_cached_property(self, pytester: Pytester):
486489
p = pytester.makepyfile(
487490
"""

0 commit comments

Comments
 (0)