Checklist
CPython versions tested on:
3.10, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.13.0a0 (heads/main:607f18c894, Aug 15 2023, 08:58:26) [GCC 11.4.0]
A clear and concise description of the bug:
Doctests belonging to a functools.cached_property are not ran by doctest.
Here is a minimal example (saved in a file t.py):
from functools import cached_property
class Foo:
@cached_property
def my_cached_property(self):
"""
>>> assert False
"""
return 1
If I then invoke doctest with this file, I'd expect to see an assertion error. Instead, this doctest is skipped:
$ python -m doctest t.py # no failing output due to assertion error
$ echo $? # zero exit code
0
Note, this issue was originally reported here: pytest-dev/pytest#11237.
Linked PRs