Skip to content
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

Make unittest.mock.Mock not appear callable #352

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Terrance
Copy link

@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.

pdoc/__init__.py Outdated Show resolved Hide resolved
@Terrance
Copy link
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).

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