We have an ancient thread about the possibility of using test mocks for maya unit tests

I’ve been looking at my test coverage and thinking that it would be good to run hard with mocks – for a number of reasons, including making it easier to manage a build server that could run without Maya. My feeling is that most unit tests really only need to verify that you’ve asked maya to do something and that you respond appropriately when Maya sends back a particular result.

Before I invest a bunch of time in this, has anybody in the four years since the last thread actually done this? Do you have any experience or insights you’d care to share?

As far as I’m aware that would be it. The concern I would have with the above is if later tests need those modules non-mocked for whatever reason they would be stuck. The patch decorator and objects are handy in starting/stopping that process to revert those modules back to an original state.

If I find I need some objects mocked across a suite, I usually have a block like this in my setUp: