<br><br><div class="gmail_quote">2011/12/16 holger krekel <span dir="ltr">&lt;<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Hans,<br>
<div class="im"><br>
On Fri, Dec 16, 2011 at 13:00 -0800, Hans Sebastian wrote:<br>
&gt; I need help and some suggestions. I run tests using py.test (latest from<br>
&gt; pip) and use unittest2.TestCase as the base class for the tests. Today, I<br>
&gt; am trying to parametrized multiple calls to a test function by following<br>
&gt; the example in the online doc. I found that it only works with test class<br>
</div>&gt; that extends from *object* but not with the one that extends from *<br>
&gt; unittest2.TestCase*. First of all, is this a bug or just not supported by<br>
&gt; py.test?<br>
<br>
Indeed, py.test parametrization does not work with unittest2.TestCase.<br>
The unittest/unittest2 support of py.test aims at compatibility<br>
and invokes some not-so-easy-to-customize unittest code.  I think it&#39;d<br>
be pretty hard to customize unittest2.TestCase to support<br>
parametrization and dynamic setups of test function arguments.<br>
<div class="im"><br>
&gt; If not possible, what are alternative ways of parametrizing<br>
&gt; testing but still want to reuse unittest2.TestCase&#39;s assert methods?<br>
<br>
</div>Not sure but weren&#39;t there some libraries which provided these kind<br>
of assert methods in a standalone manner?  It may be possible to<br></blockquote><div>Yes, a standalone lib of assert methods would work too. I created those before and worked great but looking into how i can re-use unittest&#39;s ones. <br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
add a new way to run unittest.TestCases such that py.test&#39;s parametrized<br>
testing and funcargs work - at the cost of more limited compatibility.<br>
<br>
FWIW i am happy with using assert statements and not have to remember<br>
the assert methods.  Do you see a particular shortcoming of using assert?<br>
<br></blockquote><div>No. What I have done in the past is to use assert statements but wrapping them in methods where they get logged when executed. Logging is what i care the most, useful for debugging for me. Currently I need to use unittest TestCase not only for the assert statements but also so the tests can be run without py.test as well. For this reason I realize that I cannot paramterize tests at all. <br>
<br>For now I think will do without the parameterization until we can do without unittest. <br><br>In any case, thanks for the reply. Good weekends!<br>-hans <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

best,<br>
holger<br>
<br>
&gt;<br>
&gt; Thanks<br>
&gt; -hans<br>
<br>
&gt; _______________________________________________<br>
&gt; testing-in-python mailing list<br>
&gt; <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
&gt; <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
<br>
</blockquote></div><br>