You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@blueyed you got a point, we may end up with a lot of options, which doesn't really scale.
So I'm assuming @blueyed means something like this:
# content of test_foo.py@pytest.fixturedefmocker(mocker):
mocker.defaults['autospec'] =True
The cool thing is that you can adjust the options per-test, per-module, or even the entire test suite:
# content of conftest.py@pytest.fixture(autouse=True)defmocker(mocker):
mocker.defaults['autospec'] =True
I like it. 😁
nicoddemus
changed the title
Allow to enable autospec by default
Add a "defaults" dict to mocker to allow changing defaults that are passed to mock.patch
Mar 31, 2017
I always use
autospec=True
in when patching objects. I think this helps to uncover bad mock calls.Perhaps it would be nice to be able to set this as a default value. E.g.:
The text was updated successfully, but these errors were encountered: