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
Not sure if there exists a different way to achieve what I want, but I use create_autospec extensively and ran into a case where I need to be able to reset it between the tests. I can do this manually, but then I ran into this plugin and noticed resetall, but it turned out that mocks created with create_autospec are not taken into account by resetall.
I want to avoid creating the expensive fixture on each test run, so I use session scope, but it depends on other mocks which I need to be able to configure and assert in my tests, but then I have to reset them manually.
I would rather create function scope autouse fixture, that would reset all the mocks:
But unfortunately mocks created with create_autospec are not added to the _patches_and_mocks and thus I cannot use resetall.
Would this be ok to add support for create_autospec? It seems to be pretty straightforward to add it - pretty much something like this would work, but maybe you have some other considerations?
Not sure if there exists a different way to achieve what I want, but I use
create_autospec
extensively and ran into a case where I need to be able to reset it between the tests. I can do this manually, but then I ran into this plugin and noticedresetall
, but it turned out that mocks created withcreate_autospec
are not taken into account byresetall
.Consider the following example:
I want to avoid creating the expensive fixture on each test run, so I use
session
scope, but it depends on other mocks which I need to be able to configure and assert in my tests, but then I have to reset them manually.I would rather create function scope autouse fixture, that would reset all the mocks:
But unfortunately mocks created with
create_autospec
are not added to the_patches_and_mocks
and thus I cannot useresetall
.Would this be ok to add support for
create_autospec
? It seems to be pretty straightforward to add it - pretty much something like this would work, but maybe you have some other considerations?The text was updated successfully, but these errors were encountered: