<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hi stackers,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">
I found a error after run glance tests. One of them is:</div><div class="gmail_default" style="font-family:verdana,sans-serif"><pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:13px">
======================================================================
ERROR: glance.tests.unit.test_store_image.TestStoreAddToBackend.test_bad_metadata_not_dict
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/jenkins/workspace/rebase-glance-master/glance/tests/unit/test_store_image.py", line 788, in test_bad_metadata_not_dict
    store.__str__().AndReturn(('hello'))
AttributeError: 'str' object has no attribute 'AndReturn'</pre><pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:13px">======================================================================</pre>
<pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:13px">The code around the traceback is:</pre><pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:13px">
<br></pre><pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:13px"><br></pre><pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:13px">
<span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre">def</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(153,0,0);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre">_bad_metadata</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre">(</span><span class="" style="color:rgb(153,153,153);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre">self</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre">in_metadata</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:18px;white-space:pre">):</span></pre>
<pre style="white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;font-size:13px"><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;margin-top:0px;margin-bottom:0px;line-height:18px">
<div class="" id="LC710" style="color:rgb(51,51,51);padding-left:10px"><span class="">store</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">mox</span><span class="" style="font-weight:bold">.</span><span class="">CreateMockAnything</span><span class="">()</span></div>
<div class="" id="LC711" style="color:rgb(51,51,51);padding-left:10px"><span class="">store</span><span class="" style="font-weight:bold">.</span><span class="">add</span><span class="">(</span><span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">image_id</span><span class="">,</span> <span class="">mox</span><span class="" style="font-weight:bold">.</span><span class="">IgnoreArg</span><span class="">(),</span> <span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">size</span><span class="">)</span><span class="" style="font-weight:bold">.</span><span class="">AndReturn</span><span class="">(</span></div>
<div class="" id="LC712" style="color:rgb(51,51,51);padding-left:10px">            <span class="">(</span><span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">location</span><span class="">,</span> <span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">size</span><span class="">,</span> <span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">checksum</span><span class="">,</span> <span class="">in_metadata</span><span class="">))</span></div>
<div class="" id="LC713" style="color:rgb(51,51,51);padding-left:10px"><span class="">store</span><span class="" style="font-weight:bold">.</span><span class="">__str__</span><span class="">()</span><span class="" style="font-weight:bold">.</span><span class="">AndReturn</span><span class="">((</span><span class="" style="color:rgb(221,17,68)">'hello'</span><span class="">))  <<<< </span><span style="color:rgb(0,0,0);font-size:13px;line-height:normal;white-space:pre-wrap">AttributeError here.</span></div>
<div class="" id="LC714" style="color:rgb(51,51,51);padding-left:10px"><br></div><div class="" id="LC715" style="color:rgb(51,51,51);padding-left:10px"><span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">mox</span><span class="" style="font-weight:bold">.</span><span class="">ReplayAll</span><span class="">()</span></div>
<div class="" id="LC716" style="color:rgb(51,51,51);padding-left:10px"><br></div><div class="" id="LC717" style="padding-left:10px"><font color="#999999">......</font></div><div class="" id="LC723" style="color:rgb(51,51,51);padding-left:10px">
<span class="" style="color:rgb(153,153,153)">self</span><span class="" style="font-weight:bold">.</span><span class="">mox</span><span class="" style="font-weight:bold">.</span><span class="">VerifyAll</span><span class="">()</span></div>
<div class="" id="LC723" style="color:rgb(51,51,51);padding-left:10px"><span class=""><br></span></div><div class="" id="LC723" style="color:rgb(51,51,51);padding-left:10px"><span class=""><br></span></div></pre></pre></div>
<div><div style="font-family:verdana,sans-serif" class="gmail_default">I try these codes in python shell, and raised the same exception.</div><div style="font-family:verdana,sans-serif" class="gmail_default"><br></div><div style="font-family:verdana,sans-serif" class="gmail_default">
I inspect the source code of mox, find that  "__str__()" was defined as a normal method. when we call store.__str__(), it will return a str object. Of cause str doesn't have 'AndReturn' attribute.</div>
<div style="font-family:verdana,sans-serif" class="gmail_default"><br></div><div style="font-family:verdana,sans-serif" class="gmail_default">That make me crazy, and what really confuse me is that jenkins is happy with it.</div>
<div style="font-family:verdana,sans-serif" class="gmail_default">Did I ignore somethings? Thanks in advance.</div><br></div>-- <br><div dir="ltr">Best regards,<div>gtt</div></div>
</div>