[openstack-dev] [all] [tests] Considering mock alternatives?

Dmitry Tantsur dtantsur at redhat.com
Fri Jul 10 11:04:37 UTC 2015

Hi all,

Recent breakage makes me finally raise the question that bothered me for 
some time: are there possible alternatives to mock library we could use?

A couple reasons for that:

1. Devs don't seem to care about semver, backward compatibility and all 
this boring stuff. Releasing a minor version that breaks all or vast 
majority of users is not nice at all.

2. side_effect syntax is no longer sane. Previously it was awesome:

  side_effect = Exception()
  side_effect = [value, Exception()]

etc. Now it's a big typing disaster:

  side_effect = iter([Exception()])

ok, I can live with [], I understand that it may be required for some 
corner cases. I can't understand why mock can't call iter() internally.
And seriously, it's a breaking change, and should have been 
communicated/issued a warning for some time.

If someone has contacts within mock team, are there any chances that 
will provide a convenient alternative to side_effect (though any new 
attribute would be a breaking change for Mock class)?

Any ideas?

More information about the OpenStack-dev mailing list