Big yes to asserts in pytest!

On Tue, Dec 10, 2019 at 12:50 AM Michał Słowikowski <
michal.slowikow...@polidea.com> wrote:

> I like this idea, and such assertion looks very promising.
>
> assert "maximum recursion" in str(excinfo.value)
>
> Have a nice day!
>
>
> On Mon, Dec 9, 2019 at 6:16 PM Tomasz Urbaszek <
> tomasz.urbas...@polidea.com>
> wrote:
>
> > It's definitely worth a try! I even mentioned this in AIP-27. But I think
> > this script does not change SetUp / TearDown to an appropriate  fixture.
> >
> > T.
> >
> > On Mon, Dec 9, 2019 at 6:03 PM Jarek Potiuk <jarek.pot...@polidea.com>
> > wrote:
> >
> > > Well. I think (as discussed with Kamil) maybe even convert the tests
> > > automatically.
> > >
> > > How about we try: https://github.com/pytest-dev/unittest2pytest
> > >
> > > J.
> > >
> > > On Mon, Dec 9, 2019 at 5:48 PM Tomasz Urbaszek <
> > > tomasz.urbas...@polidea.com> wrote:
> > >
> > >> I agree. Should we encourage people to use asserts when adding new
> > tests?
> > >>
> > >> T.
> > >>
> > >> On Mon, Dec 9, 2019 at 4:35 PM Kaxil Naik <kaxiln...@gmail.com>
> wrote:
> > >>
> > >>> Yup, we should.
> > >>>
> > >>> On Mon, Dec 9, 2019 at 3:20 PM Ash Berlin-Taylor <a...@apache.org>
> > wrote:
> > >>>
> > >>> > Absolutely, and I don't think any of the concers about it in
> run-time
> > >>> code
> > >>> > apply! Plus it is the way pytest recommends, and I think we get
> nicer
> > >>> > failure messages using assert-style too?
> > >>> >
> > >>> > -a
> > >>> >
> > >>> > On 9 December 2019 15:06:07 GMT, Jarek Potiuk <
> > >>> jarek.pot...@polidea.com>
> > >>> > wrote:
> > >>> > >Hello everyone.
> > >>> > >
> > >>> > >So asserts are now banned from our main code. However with the
> > recent
> > >>> > >introduction of pytest we now have a chance to switch to using the
> > >>> > >standard
> > >>> > >asserts instead of deriving from TestCase class and using
> > >>> > >assertSomething()
> > >>> > >methods.
> > >>> > >
> > >>> > >I find it much more readable and nice and pytest is great in
> > reporting
> > >>> > >the
> > >>> > >errors in a clear and readable way. And all the cases where
> asserts
> > >>> are
> > >>> > >optimized away are not valid in this case.
> > >>> > >
> > >>> > >I think we should gradually switch to using asserts in our tests.
> > >>> > >
> > >>> > >WDYT?
> > >>> > >
> > >>> > >More info:
> > >>> > >
> > >>> > >Doc about asserts in pytest:
> > >>> > >http://doc.pytest.org/en/latest/assert.html
> > >>> > >
> > >>> > >Demo of common assertion errors produced with pytest:
> > >>> > >
> > >>>
> > http://doc.pytest.org/en/latest/example/reportingdemo.html#tbreportdemo
> > >>> > >
> > >>> > >J.
> > >>> > >
> > >>> > >--
> > >>> > >
> > >>> > >Jarek Potiuk
> > >>> > >Polidea <https://www.polidea.com/> | Principal Software Engineer
> > >>> > >
> > >>> > >M: +48 660 796 129 <+48660796129>
> > >>> > >[image: Polidea] <https://www.polidea.com/>
> > >>> >
> > >>>
> > >>
> > >>
> > >> --
> > >>
> > >> Tomasz Urbaszek
> > >> Polidea <https://www.polidea.com/> | Junior Software Engineer
> > >>
> > >> M: +48 505 628 493 <+48505628493>
> > >> E: tomasz.urbas...@polidea.com <tomasz.urbasz...@polidea.com>
> > >>
> > >> Unique Tech
> > >> Check out our projects! <https://www.polidea.com/our-work>
> > >>
> > >
> > >
> > > --
> > >
> > > Jarek Potiuk
> > > Polidea <https://www.polidea.com/> | Principal Software Engineer
> > >
> > > M: +48 660 796 129 <+48660796129>
> > > [image: Polidea] <https://www.polidea.com/>
> > >
> > >
> >
> > --
> >
> > Tomasz Urbaszek
> > Polidea <https://www.polidea.com/> | Junior Software Engineer
> >
> > M: +48 505 628 493 <+48505628493>
> > E: tomasz.urbas...@polidea.com <tomasz.urbasz...@polidea.com>
> >
> > Unique Tech
> > Check out our projects! <https://www.polidea.com/our-work>
> >
>
>
> --
>
> Michał Słowikowski
> Polidea <https://www.polidea.com/> | Test Engineer
>
> E: michal.slowikow...@polidea.com
>
> Unique Tech
> Check out our projects! <https://www.polidea.com/our-work>
>

Reply via email to