Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e7f94ed

Browse files
committedSep 7, 2023
Account for Python 3.7 in the 7.4.x branch
1 parent 3dc0657 commit e7f94ed

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎src/_pytest/doctest.py

+3-1
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, "functools") 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

+3
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)
Please sign in to comment.