Skip to content

Make unittest.mock.Mock not appear callable#352

Merged
kernc merged 2 commits intopdoc3:masterfrom
Terrance-forks:mock-workaround
Jun 21, 2024
Merged

Make unittest.mock.Mock not appear callable#352
kernc merged 2 commits intopdoc3:masterfrom
Terrance-forks:mock-workaround

Conversation

@Terrance
Copy link
Copy Markdown
Contributor

@Terrance Terrance commented Aug 9, 2021

Fixes #350.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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