I have a class called DynamicMagicMock, which aims to group together related mocks and patch them all at once and provide return values as needed. It helps to consolidate and simplify what would otherwise be a more tedious process of passing a large number of functions.
However, it does a few things it doesn't need to do:
Many variants of it declare mocks that don't need to be declared -- they will be automatically generated when called.
If we eliminate those, all that remains are mocks which need to be patched -- in which case, we can simplify the logic so that we don't need to declare each one of those to be patched -- we can simply provide the patch root and that's it.
In addition, some usages of the Dynamic Magic Mock are unnecessary, and can be replaced with a simple MagicMock.
Requirements
Resolve the above issues.
Tests
All tests currently run should still pass after completion. Testing logic additionally should not need to be modified.
Context
I have a class called DynamicMagicMock, which aims to group together related mocks and patch them all at once and provide return values as needed. It helps to consolidate and simplify what would otherwise be a more tedious process of passing a large number of functions.
However, it does a few things it doesn't need to do:
In addition, some usages of the Dynamic Magic Mock are unnecessary, and can be replaced with a simple MagicMock.
Requirements
Tests
Docs
Open questions