Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #3513 > unrolled thread

logassert v6

Started byFacundo Batista <facundobatista@gmail.com>
First post2020-10-25 19:22 -0300
Last post2020-10-25 19:22 -0300
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python.announce


Contents

  logassert v6 Facundo Batista <facundobatista@gmail.com> - 2020-10-25 19:22 -0300

#3513 — logassert v6

FromFacundo Batista <facundobatista@gmail.com>
Date2020-10-25 19:22 -0300
Subjectlogassert v6
Message-ID<160366645585.22283.python-announce-list@python.org>
logassert is a simple log assertion mechanism for Python unittests.

Why? As is vox populi, you must also test the logging calls in your
programs. With logassert this is now very easy.

In this version:

- Simple way to check that nothing was logged (on any level or a specific one):

    assert NOTHING in logs.debug

- Helper to check that several lines were logged one after the other:

    assert Sequence(
        "Got 1 error and \d+ warnings:",
        Exact("  error: bar"),
    ) in logs.debug

- Show proper message when "not in" assertion is used (thanks Diego Mascialino)

Regards,

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org.ar/
Twitter: @facundobatista

[toc] | [standalone]


Back to top | Article view | comp.lang.python.announce


csiph-web