<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 1, 2016 at 2:42 AM, Thomas De Schampheleire <span dir="ltr">&lt;<a href="mailto:patrickdepinguin@gmail.com" target="_blank">patrickdepinguin@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Oliver,<br>
<span class=""><br>
On Fri, Apr 1, 2016 at 6:17 AM, oliver &lt;<a href="mailto:oliver.schoenborn@gmail.com">oliver.schoenborn@gmail.com</a>&gt; wrote:<br>
&gt; Thomas, is your idea that given test code like this:<br>
&gt;<br>
&gt; from unittest.case import TestCase<br>
&gt; class YourTestCase(TestCase):<br>
&gt;     def setUp(self):<br>
&gt;          do stuff<br>
&gt;     def test1(self):<br>
&gt;          a, b = 2, 1<br>
&gt;          self.assertGreater(a, b)<br>
&gt;<br>
&gt;<br>
&gt; you would prefer to convert to what, something like this:<br>
&gt;<br>
&gt; from unittest.case import TestCase<br>
&gt; class YourTestCase(TestCase):<br>
&gt;     def setup_method(self):<br>
&gt;          do stuff<br>
&gt;     def test1(self):<br>
&gt;          a, b = 2, 1<br>
&gt;          assert a &gt; b<br>
&gt;<br>
&gt;<br>
&gt; Am i understanding correctly?<br>
<br>
</span>Yes, indeed. Although that I think that to allow the setup_method<br>
calls you can no longer inherit from unittest. In my case, we had:<br>
<br>
class YourTestCase(TestController)<br>
<br>
where TestController is unittest-based which I am replacing to<br>
<br>
class YourTestCase(TestControllerPytest)<br>
<br>
But that last type of conversion is probably impossible for a general<br>
script like nose2pytest, so I can imagine I&#39;ll do that conversion<br>
manually.<br></blockquote><div><br></div><div>DId you mean TestCase? Can you provide more detail, this looks like a straight rename. Removing the base class is definitely possible, and I believe the two unittest2pytest do this, have you tried them? </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Do you think the assert conversion is possible?<br></blockquote><div><br></div><div>For sure, but as Florian pointed out, this already seems possible via unittest2pytest, is there something that nose2pytest does for nose tests that neither of the 2 unittest2pytest do for unittest tests? </div><div><br></div><div>Oliver</div><div><br></div></div></div></div>