<div dir="ltr"><font><font>Hi joehuang,</font></font><div><font><font>by removing self it is showing following error.</font></font></div><div><font><font><br></font></font></div><div><font><font><div><font><font> File "/home/khayam/tricircle/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1206, in _importer</font></font></div><div><font><font> thing = __import __ (import_path)</font></font></div><div><font><font>Import Error: No module named app</font></font></div><div><font><font>Ran 135 tests in 2.994s (+ 0.940s)</font></font></div><div><br></div></font></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 14, 2016 at 5:53 AM, joehuang <span dir="ltr"><<a href="mailto:joehuang@huawei.com" target="_blank">joehuang@huawei.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="ZH-CN" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">Hi, Khayam,
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">@</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#0000b2">mock.patch</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">(</span><b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:green">'self.app.post_json'</span></b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">No “self.” needed.</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">Best Regards<u></u><u></u></span></p>
<p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d">Chaoyi Huang ( Joe Huang )</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Khayam Gondal [mailto:<a href="mailto:khayam.gondal@gmail.com" target="_blank">khayam.gondal@gmail.com</a>]
<br>
<b>Sent:</b> Wednesday, April 13, 2016 2:50 PM<br>
<b>To:</b> OpenStack Development Mailing List (not for usage questions)<br>
<b>Cc:</b> joehuang; Zhiyuan Cai<br>
<b>Subject:</b> [Tricircle] Error runnig py27<u></u><u></u></span></p>
</div><div><div class="h5">
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi I am writing a test for exception . Following is my testing function.<u></u><u></u></span></p>
<div>
<pre><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">@</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#0000b2">mock.patch</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">(</span><b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:green">'self.app.post_json'</span></b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">)<br></span><b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:navy">def </span></b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">test_post_exp(</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#94558d">self</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">, mock_get, mock_http_error_handler):<br><br> mock_response = mock.Mock()<br> mock_response.raise_for_status.side_effect = db_exc.DBDuplicateEntry<br> mock_get.return_value = mock_response<br> mock_http_error_handler.side_effect = db_exc.DBDuplicateEntry<br> </span><b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:navy">with </span></b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#94558d">self</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">.assertRaise(db_exc.DBDuplicateEntry):<br> </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#94558d">self</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">.app.post_json(<br> </span><b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:green">'/v1.0/pods'</span></b><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">,<br> </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:navy">dict</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">(</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#660099">pod</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">=</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:navy">None</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">),<br> </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:#660099">expect_errors</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">=</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:navy">True</span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black">)<u></u><u></u></span></pre>
<pre><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#222222">But when I run tox -epy27 it shows: </span><span lang="EN-US" style="font-size:9.0pt;font-family:"Courier New";color:black"><u></u><u></u></span></pre>
<pre><span lang="EN-US" style="font-family:"Arial","sans-serif""> <b> File "/home/khayam/tricircle/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1206, in _importer</b></span><span lang="EN-US"><u></u><u></u></span></pre>
<pre><b><span lang="EN-US" style="font-family:"Arial","sans-serif""> thing = __import__(import_path)</span></b><span lang="EN-US"><u></u><u></u></span></pre>
<pre><b><span lang="EN-US" style="font-family:"Arial","sans-serif"">ImportError: No module named self</span></b><span lang="EN-US"><u></u><u></u></span></pre>
<pre><span lang="EN-US" style="font-family:"Arial","sans-serif"">Can someone guide me whats wrong here. I already had installed latest version of mock, python-dev. </span><span lang="EN-US"><u></u><u></u></span></pre>
<div>
<pre><span lang="EN-US" style="font-family:"Arial","sans-serif";color:#222222"><u></u> <u></u></span></pre>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>