Skip to content

Make unittest.mock.Mock not appear callable #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

Terrance
Copy link
Contributor

@Terrance Terrance commented Aug 9, 2021

Fixes #350.

Copy link
Member

@kernc kernc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a minimal unit test showing that documenting Mock objects doesn't crash and so that we don't accidentally break this Python bug workaround in the future? I'd also test assert inspect.signature(Mock(spec=lambda x: x)) in order to catch it when Python finally fixes the thing.

@Terrance
Copy link
Contributor Author

I've included a class with mocks in the test class' example module, and added a test against the signature as an expected failure (so it will show up as an unexpected success if Python's behaviour changes in the future).

@kernc
Copy link
Member

kernc commented Jun 21, 2024

Lgtm. Thanks!

@kernc kernc merged commit 56bbc9c into pdoc3:master Jun 21, 2024
kernc pushed a commit to kernc/pdoc that referenced this pull request Jun 22, 2024
…#352)

* BUG: Make `unittest.mock.Mock` not appear callable (fix pdoc3#350)

* Add class with mocks to unit test example package
kernc pushed a commit to johann-petrak/pdoc that referenced this pull request Jun 22, 2024
…#352)

* BUG: Make `unittest.mock.Mock` not appear callable (fix pdoc3#350)

* Add class with mocks to unit test example package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

pdoc trips over unittest.mock.Mock
2 participants