Seecr Testtools
Small helpers for writing pytest tests, used across Seecr projects.
Installation
pip install seecr-testtools
Requires Python 3.11 or newer. Installs pytest and pytest-asyncio.
What's inside
anything: wildcards in assertions
anything equals every value, so you can compare whole structures while
ignoring the parts you don't care about. Pass a function to check a value
instead of ignoring it.
from seecr_testtools import anything
assert response == {
"id": anything, # any value
"name": "Alice",
"age": anything(lambda age: age >= 18), # must satisfy the check
}
Mock: record calls and fake return values
from seecr_testtools.mock import Mock
store = Mock.blank(get={"a": 1}.get, save=None)
store.get("a") # 1: a callable value is called
store.save(1, force=True) # None: other values are returned as is
store.whatever() # unknown methods return None
store.calls("save") # [save(1, force=True)]
store.calls("save")[0].kwargs # {'force': True}
Mock.imitate(obj) wraps a real object. Methods you override with
mock_method are replaced on the object itself, so the object's own code
calls the fake too. Coroutine methods automatically get an async fake.
class Repository:
def load(self):
return "from database"
def report(self):
return self.load().upper()
repo = Repository()
mock = Mock.imitate(repo)
mock.mock_method("load", "fake")
assert mock.report() == "FAKE" # report() runs for real, load() is faked
assert len(mock.calls("load")) == 1
For a blank mock, use mock_method(name, value, is_async=True) to get an
async method.
login_user
Logs a user in on a test client for Seecr web applications and keeps the
session cookie: login_user(env, username, password). It expects env to
provide client and actions.
Development
python -m venv env --prompt seecr-testtools
source env/bin/activate
pip install -e .
pytest
Tests live next to the code as <module>_test.py. Async tests need no
decorator: pytest-asyncio runs in auto mode.
License
Copyright (C) 2024-2026 Seecr (Seek You Too B.V.)
Licensed under the MIT License.
Metadata
Release files for seecr-testtools 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 |
|---|---|---|---|---|
| seecr_testtools-0.4.3.tar.gz | 9.5 kB | With provenance | Details for seecr_testtools-0.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seecr_testtools-0.4.3-py3-none-any.whl | Python 3 | none | any | Details for seecr_testtools-0.4.3-py3-none-any.whl |
Total release size: 18.0 kB
Release files / seecr_testtools-0.4.3.tar.gz
| Download URL | seecr_testtools-0.4.3.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fae46760b9aac6ce005460a42762ce400321e34fe60d9b00784d6e0ec9a16eb6
|
|
BLAKE2b-256 checksum How to use checksums |
338424279ce2af63d21bdc20bf7a8ad3689153ae612f6dde54019e0bae17c2e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / seecr_testtools-0.4.3-py3-none-any.whl
| Download URL | seecr_testtools-0.4.3-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efd670ea4bd89367100bea0a097b16f30725f33918c7394d8452d89a60b7feb1
|
|
BLAKE2b-256 checksum How to use checksums |
2f52ec960ff9e73441d3f5104d8089d187be75fbdac4e14ecf0dc8a3afb2ea01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for seecr-testtools 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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for seecr_testtools-0.4.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA 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.