Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.4.3 instead.
Reason given by maintainers: Switched licenss from GPL to MIT

Seecr Testtools

Small helpers for writing pytest tests, used across Seecr projects.

Tests PyPI

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 GNU General Public License v3.0 or later.

Metadata

Release files for seecr-testtools 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seecr-testtools 0.4.2
File Size Uploaded Provenance Actions
seecr_testtools-0.4.2.tar.gz 21.4 kB With provenance Details for seecr_testtools-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for seecr-testtools 0.4.2
File Interpreter ABI Platform Actions
seecr_testtools-0.4.2-py3-none-any.whl Python 3 none any Details for seecr_testtools-0.4.2-py3-none-any.whl

Total release size: 43.0 kB

Release files / seecr_testtools-0.4.2.tar.gz

Download URL seecr_testtools-0.4.2.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1b44fc212513cb528b2a79f358657eedd6dc5e383718eeeba93a59af4b9640bf
BLAKE2b-256 checksum
How to use checksums
0f27144882f4c1a58b5cdb4995970d3ad0aeb3fd70090285b3d464b50c6324ee
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 log

Release files / seecr_testtools-0.4.2-py3-none-any.whl

Download URL seecr_testtools-0.4.2-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
205181f5357918d28ebc0f8d4c85a74d6c217c7429d39c4600a632ff933d2dbb
BLAKE2b-256 checksum
How to use checksums
02b2607dd74152e0565a22cef3e4ed11625aa80ce4dd24a0026f7a9342bdb143
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 log

Security for seecr-testtools 0.4.2

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.

Select from 2 files

Attestation for seecr_testtools-0.4.2.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 log

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.

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page