<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 11 October 2016 at 16:23, Clay Gerrard <span dir="ltr"><<a target="_blank" href="mailto:clay.gerrard@gmail.com">clay.gerrard@gmail.com</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr">Greetings!<br><br>Anyone have any experience to share positive or negative using requests-mock?  I see it's been used to replace another dependency that had some problems in many of the OpenStack python client libraries:<br><br>Added to global requirements -> <a target="_blank" href="https://review.openstack.org/#/c/104067">https://review.openstack.org/#<wbr>/c/104067</a><div>Added to novaclient -> <a target="_blank" href="https://review.openstack.org/#/c/112179/">https://review.openstack.org/#<wbr>/c/112179/</a><div>Added to cinderclient -> <a target="_blank" href="https://review.openstack.org/#/c/106665/">https://review.openstack.org/#<wbr>/c/106665/</a></div><div>Added to keystoneclient -> <a target="_blank" href="https://review.openstack.org/#/c/106659/">https://review.openstack.org/#<wbr>/c/106659/</a><br><br>But I'm not sure how folks other than Jamie are getting on with it?  When writing new tests do you tend to instinctively grab for requests-mock - or do you mostly not notice it's there?  Any unexpected behaviors ever have you checking it out with bzr and reading over the source?  Do you recall ever having any bumps or bruises in the gate or in your development workflow because of a new release from requests-mock?  No presumed fault on Jamie!  It seems like he's doing a Herculean one-man job there; but it can be difficult go it alone:<div><br></div><div><a target="_blank" href="https://bugs.launchpad.net/requests-mock/+bug/1616690">https://bugs.launchpad.net/<wbr>requests-mock/+bug/1616690</a><br></div><div><br></div><div>It looks like the gate on this project is configured to run nova & keystone client tests; so that may be sufficient to catch any sort of issue that might come up in something that depends on it?  Presumably once he lands a change - he does the update to global-requirements and then all of OpenStack get's it from there?</div><div><br></div><div>I ask of course because I really don't understand how this works [1] :D</div><div><br></div><div>But anyway - Jamie was kind enough to offer to refactor some tests for us - but in the process seems to require to bring in these new dependencies - so I'm trying to evaluate if I can recommend requiring this code in order to develop on swiftclient [2].</div><div><br></div><div>Any feedback is greatly appreciated!</div><div><br></div><div>-Clay</div><div><br></div><div>1. As you may know (thanks to some recently publicity) swift & swiftclient joined OpenStack in the time of dinosaurs with a general policy of trying to keep dependencies to a *minimum* - but then one day the policy changed to... *always* add dependencies whenever possible?  j/k I'm not acctually sure what the OpenStack policy is on dependency hygiene :D  Anyway, I can't say *exactly* where that "general policy" came from originally?  Presumably crieht or gholt just had some first hand experience that the dependencies you choose to add have a HUGE impact on your project over it's lifetime - or read something from Joel on Software - <a target="_blank" href="http://www.joelonsoftware.com/articles/fog0000000007.html">http://www.joelonsoftware.com/<wbr>articles/fog0000000007.html</a> - or traveled into the future and read the "go proverbs" and google'd "npm breaks internet, again".  Of course they've since moved on from OpenStack but the general idea is still something that new contributors to swift & swiftclient get acclimated to and the circle of confusion continues <a target="_blank" href="https://github.com/openstack/swift/blob/master/CONTRIBUTING.rst#swift-design-principles">https://github.com/openstack/<wbr>swift/blob/master/<wbr>CONTRIBUTING.rst#swift-design-<wbr>principles</a> - but hey!  maybe I can educate myself about the OpenStack policy/process; add this dependency and maybe the next one too; then someday break the cycle!?!?</div><div><div><br></div><div>2. <a target="_blank" href="https://review.openstack.org/#/c/360298">https://review.openstack.<wbr>org/#/c/360298</a></div><div><br></div></div></div></div></div>
<br>______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a target="_blank" rel="noreferrer" href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a target="_blank" rel="noreferrer" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">Clay, <br><br></div><div class="gmail_extra">So I'm not going to comment too much on the quality of the library as i obviously think it's good (and AFAIK we've never broken an API).<br><br></div><div class="gmail_extra">The only thing I'd like to clarify is that I'm never coming to clients with the intent of converting tests to use requests-mock to promote the library. I'm probably the main person behind most of the keystoneauth work and one of the biggest problems I've had with trying to convert projects to work with keystoneauth (and keystoneclient before that) is that mocking out the request.request function, or the whole keystoneclient Client as swiftclient does has made the unit tests very strictly locked to the current way things are done. By converting the clients to a request level mock I've been able to change the way the clients authenticate whilst proving there are no change in the requests made.<br><br></div><div class="gmail_extra">The same is true of swiftclient, though it's a longer and slower process there as i've discussed with people in the past - and would like to try again at summit. Patches [1][2] exists to bring some support of keystoneauth to swiftclient (which would make the hacking i'm currently trying to do on glance_store much easier), but ideally i would like to go further because there is existing and proven support for things like reauthenticating a token on 401 via keystoneauth rather than the current, somewhat hacky method, that would greatly simplify the interaction between the openstack services and swift. <br><br>Swiftclient is the last major client to not support keystoneauth, which is currently a blocker for people experimenting with things such as kerberos authentication for services, and currently the glance_store/swiftclient interaction [3] is at the top of my failure list for deprecating the old ways of consuming keystoneclient [4] - in part at least because it is implementing it's own connection manager which keystoneauth could do. <br><br></div><div class="gmail_extra">Anyway, to summarize, I've started leading with requests-mock changes to a project simply to decouple the tests from mocking exact function calls with the bare minimum of implemented attributes which may be called differently in future. If swiftclient chooses to not accept the dependency we'll find another way to do keystoneauth integration, it'll probably just involve a whole lot more hacking with unrelated tests that i personally consider more dangerous.<br></div><div class="gmail_extra"><br>Jamie<br><br><br><br>[1] <a href="https://review.openstack.org/#/c/298968/">https://review.openstack.org/#/c/298968/</a><br>[2] <a href="https://review.openstack.org/#/c/300697/">https://review.openstack.org/#/c/300697/</a><br>[3] <a href="https://git.openstack.org/cgit/openstack/glance_store/tree/glance_store/_drivers/swift">https://git.openstack.org/cgit/openstack/glance_store/tree/glance_store/_drivers/swift</a><br>[4] <a href="https://review.openstack.org/#/c/359707/">https://review.openstack.org/#/c/359707/</a><br></div></div>