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

> Hi Oliver,
>
> On Fri, Apr 1, 2016 at 6:17 AM, oliver <oliver.schoenb...@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
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to