Fix doctest collection of functools.cached_property objects.#11317
Fix doctest collection of functools.cached_property objects.#11317RonnyPfannschmidt merged 4 commits intopytest-dev:mainfrom
functools.cached_property objects.#11317Conversation
| # Type ignored because this is a private function. | ||
| return super()._from_module(module, object) # type: ignore[misc] | ||
|
|
||
| if self.path.name == "conftest.py": |
There was a problem hiding this comment.
At first glance this Looks like this ought to be a extra elif next two the property handling of the mock class with the hack's
There was a problem hiding this comment.
Yeah that makes perfect sense. I'm going to wait on the cpython fix to be implemented before pushing this forward. It might offer some additional insights.
There was a problem hiding this comment.
python/cpython#107996 has been merged. I think the original idea of the PR is still the way to fix this issue. However, I did move the method override of _from_module to the pre-existing DocTestFinder subclass.
There was a problem hiding this comment.
Should we rename MockAwareDocTestFinder?
bluetech
left a comment
There was a problem hiding this comment.
LGTM! I'll let @RonnyPfannschmidt do the merge.
|
Should we backport this? |
|
I'm under the impression we should |
|
Can you review/merge and backport then @RonnyPfannschmidt ? Or would you like me to go ahead with it? |
|
I won't be able to get to it before next week earliest |
|
@nicoddemus any idea why the back-porting workflow failed? |
We need to add the |
|
i see, can we also trigger it on a merge if there is the label applied? |
|
We did consider it at the time, but IIRC it would complicate the action significantly and nobody wanted to tackle that. |
- pytest-dev/pytest@e787d2e - pytest-dev/pytest#11317 - https://github.com/python/cpython/blob/1c26f1ce6c3965b1f7395b60bf45d7fc0bc6de57/Lib/doctest.py#L948-L975 - https://github.com/python/cpython/blob/0c56c0502270ebe29461fe5cab3ee4d6111da650/Lib/doctest.py#L954-L981
I'll be first to admit that the proposed solution is very hacky but felt inspired by some adjacent code to do things this way. Suggestions for improvement are welcomed. 🙂
closes #11237