Utterless
Extend Python's "unittest" to better handle "logging" messages
There's a problem when you try to run a
unittest
test suite in a codebase which also uses the
logging
framework:
You see your nice output of dots (...F....SS....F..)
clogged up with lots of log messages.
For occasional cases you can supress log messages in a block
of code with self.assertLogs(...).
But that doesn't scale when almost every test in your suite
generates messages.
Alternatively you can fiddle your log levels so that all log messages get supressed. But when you have a failing test the log messages can be very helpful in debugging it.
Wouldn't it be great to have an alternative log runner that captures all log messages. If the test fails the messages get displayed with the error traceback. But if the test succeeds then the log messages get silently discarded.
Look no further! This is possibly the package you want.
Usage
We assume you already have a test suite that you run something like this:
$ python -m unittest discover
Having installed utterless you just need to replace that with:
$ python -m utterless discover
Optional Usage
Utterless has mechanisms to integrate with some frameworks that
don't run tests through unittest directly.
For example, with Django you can specify the Utterless test runner on the command line:
$ ./manage.py test --testrunner utterless.contrib.django.DiscoverRunner
or by editing settings.py to contain:
TEST_RUNNER = "utterless.contrib.django.DiscoverRunner"
Licence
This software copyright P. S. Clarke and is licensed in accordance with the BSD Three-Clause Licence.
Limitations and Roadmap
- Currently it completely ignores the
warningsmodule, so output from that (e.g. aDeprecationWarningor aResourceWarning) will still splurts across the screen. I could possibly collect that up during tests and include it at the end. The complication is that warnings should probably still be emited regardless of whether the test passed or failed. Treating warnings as errors might be the better option.
Metadata
Release files for utterless 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| utterless-0.4.3.tar.gz | 6.3 kB | Without provenance | Details for utterless-0.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| utterless-0.4.3-py3-none-any.whl | Python 3 | none | any | Details for utterless-0.4.3-py3-none-any.whl |
Total release size: 11.9 kB
Release files / utterless-0.4.3.tar.gz
| Download URL | utterless-0.4.3.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0e849749efc2ebbcf4011193802176880c473a398d8b56d4d8fbc3f43690fc7
|
|
BLAKE2b-256 checksum How to use checksums |
d118443ed18afcf0d319cf57207b11333749a99c7ccb1fd3e773775292d98952
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / utterless-0.4.3-py3-none-any.whl
| Download URL | utterless-0.4.3-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83e67c32252924052ce6e84ab6c922c20bbfb304c33df8c06542a86565dbe2d9
|
|
BLAKE2b-256 checksum How to use checksums |
a0b9f0537d49f5e27c944599583b6fe451aaa6a4fc2a4ee2053eab75d6fd1b95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for utterless 0.4.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.