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


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

logassert v6

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Facundo Batista <facundobatista@gmail.com>
Newsgroups comp.lang.python.announce
Subject logassert v6
Date Sun, 25 Oct 2020 19:22:55 -0300
Lines 28
Approved python-announce-list@python.org
Message-ID <160366645585.22283.python-announce-list@python.org> (permalink)
Reply-To python-list@python.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace news.uni-berlin.de 9auDnNUI9F+HEHi1dywJLgjL7uIxb0rqprm2mP7xQZwg==
Authentication-Results mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=AW2vn/cM; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'error:': 0.05; 'mechanism': 0.07; 'twitter:': 0.07; 'logged': 0.09; 'log': 0.15; 'python': 0.15; '"not': 0.16; 'blog:': 0.16; 'facundo': 0.16; 'from:addr:facundobatista': 0.16; 'from:name:facundo batista': 0.16; 'other:': 0.16; 'pyar:': 0.16; 'received:mail- io1-xd30.google.com': 0.16; 'url-ip:104.18.38.86/32': 0.16; 'url- ip:104.18.38/24': 0.16; 'url-ip:104.18.39.86/32': 0.16; 'url- ip:104.18.39/24': 0.16; 'url-ip:172.67.204.199/32': 0.16; 'url- ip:52.168.19.255/32': 0.16; 'url-ip:52.168.19/24': 0.16; 'url- ip:52.168/16': 0.16; 'url:plog': 0.16; 'url:taniquetil': 0.16; 'skip:@ 10': 0.18; 'calls': 0.20; 'error': 0.25; 'lines': 0.29; 'message-id:@mail.gmail.com': 0.33; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35; 'programs.': 0.36; 'way': 0.36; 'proper': 0.37; 'specific': 0.39; 'check': 0.60; 'your': 0.65; 'logging': 0.70; 'url-ip:104.18/16': 0.72; 'easy.': 0.84; 'to:addr :python-announce': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=tvSxIvuXVW/zQ3KEm/XTNhbioTOCjh3n+oMbps6OiFk=; b=AW2vn/cMcgj8/Xj1Vb8wxXGediv6A8p37iTg1IOg4+a+PmTKFeYB3hSoxwbZBOgX5C Xo6tUIFqP75w6LO8V2CWStAXcZpNJL/81ikIrjZKokSFD+obHx2D19FBGhKqdmfCaGN0 NgBrPo8wq2HlHwEb7S1OGmJRJeYDw/ZB6YpGpmWNkLTYt9ss1CX508oCMYrX08YTm9nW OslG8F3GFwO+Gb1HNgttSaOWg/3ScdK+uPpyT83KwK87z4s8WVZbNe6LBEScrxwRrtCx bmqcNsOeCb/ocrh1XBkWiG1MufuJnfMu/GHCf/fOYGLeBYfUBOI8IIeFl0r5OXBA3roW zOUw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=tvSxIvuXVW/zQ3KEm/XTNhbioTOCjh3n+oMbps6OiFk=; b=FqJUkh2h9lxwdVZ0nyDQLCtJL+NjrU6uDOKrJCbvsieqFceD+5SGf4Fgk1BjnKNr1j 1JuAeN1gXdPLAm8mBhBm8biGb8AA0hWuqt5HMdkuW4B0MhtkfWNZbMqti+vhl45749d5 6/ESdJuPdZNsm7D+oS6bC/B+KUk45Kt1mBYCoKVkOLX8FwEgb50IJ8N1fb6gYBgILKuF gpbbU6f4y7w2AhJdQsggYfV18qTwPZqlf1SPFgKG4QWKVLpoBIayp+rxv5C4OykLSD4Z MRCiZCA2UkU6lPMMZCaNVl+cf1Q3ypOwUq6F8KS1kLpS+Cbi4D/rafmgZjdytDtuk6R3 Sw9A==
X-Gm-Message-State AOAM530I8vZzhGtdofu/GRjQUCYi278hxKjAPXgEMWZGF0FE7xU7INTb yHjd2gMG404W0AWxVdORHws6kCuabsndM5/L6YrhOu/rMgzrNA==
X-Google-Smtp-Source ABdhPJyc8tmtP6nuWbuLZuhC4Ls1CYFx3SxxnB0rDY6L7aSc7+ykkt5gX9s5WzsR7MXB0PnLhGrOhAfXDS38g2cRC1A=
X-Received by 2002:a05:6638:f81:: with SMTP id h1mr5186253jal.115.1603664586815; Sun, 25 Oct 2020 15:23:06 -0700 (PDT)
X-MailFrom facundobatista@gmail.com
X-Mailman-Rule-Hits emergency
X-Mailman-Rule-Misses dmarc-mitigation; no-senders; approved
Message-ID-Hash AANXEVMQVW5U6AM7PTATXVOHLB665OC5
X-Message-ID-Hash AANXEVMQVW5U6AM7PTATXVOHLB665OC5
X-Mailman-Approved-At Sun, 25 Oct 2020 18:54:04 -0400
X-Mailman-Version 3.3.2rc2
Precedence list
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
Archived-At <https://mail.python.org/archives/list/python-announce-list@python.org/message/AANXEVMQVW5U6AM7PTATXVOHLB665OC5/>
List-Archive <https://mail.python.org/archives/list/python-announce-list@python.org/>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Post <mailto:python-announce-list@python.org>
List-Subscribe <mailto:python-announce-list-join@python.org>
List-Unsubscribe <mailto:python-announce-list-leave@python.org>
Xref csiph.com comp.lang.python.announce:3513

Show key headers only | View raw


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

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web