facebook/TestSlide

Reject mocking classes with mock_(async_)_callable

Closed this issue · 2 comments

We have mock_constructor() for this case:

self.mock_callable(module, "ClassName")

Lets' turn this into a ValueError, suggesting the usage of mock_constructor()

            if inspect.isclass(original_callable):
                raise ValueError(
                    f"{name}() can not be used with with classes: "
                    f"{repr(original_callable)}. Perhaps you want to use "
                    "mock_constructor() instead."
                )

This is already in place in https://github.com/facebookincubator/TestSlide/blob/master/testslide/mock_callable.py#L612
Maybe we should close this

Indeed!