[TIP] [pytest-dev] ANN: nose2pytest 1.0

oliver oliver.schoenborn at gmail.com
Fri Apr 1 14:22:05 PDT 2016


On Fri, Apr 1, 2016 at 2:42 AM, Thomas De Schampheleire <
patrickdepinguin at gmail.com> wrote:

> Hi Oliver,
>
> On Fri, Apr 1, 2016 at 6:17 AM, oliver <oliver.schoenborn at gmail.com>
> wrote:
> > Thomas, is your idea that given test code like this:
> >
> > from unittest.case import TestCase
> > class YourTestCase(TestCase):
> >     def setUp(self):
> >          do stuff
> >     def test1(self):
> >          a, b = 2, 1
> >          self.assertGreater(a, b)
> >
> >
> > you would prefer to convert to what, something like this:
> >
> > from unittest.case import TestCase
> > class YourTestCase(TestCase):
> >     def setup_method(self):
> >          do stuff
> >     def test1(self):
> >          a, b = 2, 1
> >          assert a > b
> >
> >
> > Am i understanding correctly?
>
> Yes, indeed. Although that I think that to allow the setup_method
> calls you can no longer inherit from unittest. In my case, we had:
>
> class YourTestCase(TestController)
>
> where TestController is unittest-based which I am replacing to
>
> class YourTestCase(TestControllerPytest)
>
> But that last type of conversion is probably impossible for a general
> script like nose2pytest, so I can imagine I'll do that conversion
> manually.
>

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?


>
> Do you think the assert conversion is possible?
>

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?

Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20160401/538db3cc/attachment.htm>


More information about the testing-in-python mailing list