<div dir="ltr"><div style="text-align:justify">"<span class="" style="font-style:italic;color:rgb(0,0,0);font-family:sans-serif;font-size:16px;line-height:20px;text-align:justify">Changed in version 2.7: </span><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;line-height:20px;text-align:justify">Added the ability to use </span><a class="" href="http://docs.python.org/2/library/unittest.html#unittest.TestCase.assertRaises" title="unittest.TestCase.assertRaises" style="color:rgb(53,95,124);text-decoration:initial;font-family:sans-serif;font-size:16px;line-height:20px;text-align:justify"><tt class="" style="background-color:transparent;padding:0px 1px;font-size:0.95em;font-weight:bold"><span class="">assertRaises()</span></tt></a><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;line-height:20px;text-align:justify"> as a context manager."</span></div>
<div style="text-align:justify"><font color="#000000" face="sans-serif" size="3"><span style="line-height:20px"><br></span></font></div><div style="text-align:justify"><font color="#000000" face="sans-serif"><span style="line-height:20px"><font size="3">Source: <a href="http://docs.python.org/2/library/unittest.html">http://docs.python.org/2/library/unittest.html</a></font></span></font></div>
</div><div class="gmail_extra"><br clear="all"><div><div><br></div>-Dolph</div>
<br><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 12:25 PM, Paul Michali <span dir="ltr"><<a href="mailto:pcm@cisco.com" target="_blank">pcm@cisco.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Did some googling and it looks like 2.6 doesn't support assertRaises as a context manager.<div><br></div><div><br><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">PCM (Paul Michali)<br>
<br></span></div><div><div class="h5"><div><div>On Feb 8, 2013, at 1:17 PM, Paul Michali wrote:</div><br><blockquote type="cite"><div style="word-wrap:break-word">I'm working on a bug and I had this code, which passes UT on my system running python2.7, but fails Jenkin's python2.6 run:<div>
<br></div><div><div><div> def test_missing_required_config(self):</div><div> args = ['--config-file',</div><div> os.path.join(TEST_ETC_AREA, 'bad-quantum.conf.test')]</div><div>
with self.assertRaises(cfg.RequiredOptError):</div><div> config.parse(args=args)</div></div><div><br></div><div>First Jenkins failure (looks like python2.6) says:</div><div><br></div><div><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;text-transform:none;font-style:normal;font-size:11px;font-weight:normal;word-spacing:0px">
ft116.1: quantum.tests.unit.test_config.RequiredConfigTest.test_missing_required_configTraceback (most recent call last):
File "/usr/lib/python2.6/unittest.py", line 279, in run
testMethod()
File "/home/jenkins/workspace/gate-quantum-python26/quantum/tests/unit/test_config.py", line 59, in test_missing_required_config
with self.assertRaises(cfg.RequiredOptError):
TypeError: failUnlessRaises() takes at least 3 arguments (2 given)
</pre><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px"><font face="Helvetica">Is there an issue with 2.6 supporting with clause and assertRaises, or is there a backward compatibility issue? I'm trying changing it to this...</font></pre>
</div><div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica"><font size="3"> <span style="color:#063ff4">def</span> <b>test_missing_required_config</b>(<i>self</i>):</font></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica"><font size="3"> args = [<span style="color:#00b339"><i>'--</i></span><span style="text-decoration:underline;color:#00b339"><i>config</i></span><span style="color:#00b339"><i>-file'</i></span>,</font></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica"><font size="3"> os.path.join(TEST_ETC_AREA, <span style="color:#00b339"><i>'bad-quantum.conf.test'</i></span>)]</font></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica"><font size="3"> <i>self</i>.assertRaises(cfg.RequiredOptError, config.parse, args=args)</font></div>
</div><div><br></div><div><br></div><div>
PCM (Paul Michali)<br><br></div></div></div></blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>