Skip to main content

simple_module_test

Shared pytest fixtures and helpers for writing tests against simple_module apps and modules.

Fixtures are exposed via a pytest11 entry point, so installing the package is enough — no conftest.py import needed.

Install

pip install simple_module_test
# or, if you already pulled in the framework:
pip install "simple_module_hosting[dev]"

What it provides

All fixtures below are auto-registered via the pytest11 entry point — installing the package is enough.

  • fake_event_bus — a fresh recording EventBus per test that captures every publish/publish_nowait call.
  • build_test_app — callable returning a minimal FastAPI app that loads exactly one module.
  • settings — a ready-to-use Settings instance with an in-memory SQLite database and multi-tenancy enabled.
  • db_state, engine, db_session — fresh DatabaseState per test; db_session also creates all module tables and stamps alembic_version at head so the boot-time migration check passes.
  • app — a create_app(settings) instance with lifespan started and stopped.
  • client — an httpx.AsyncClient bound to the test app.
  • authenticated_client — same but with an admin user seeded and a forged session cookie attached. Requires the users module to be installed (it seeds the admin via users.bootstrap); apps scaffolded by smpy include it.

Usage

In a module's tests/test_something.py:

import pytest

pytestmark = pytest.mark.asyncio


async def test_create_order(authenticated_client):
    resp = await authenticated_client.post(
        "/api/orders",
        json={"customer_id": 1, "total_cents": 9900},
    )
    assert resp.status_code == 201
    assert resp.json()["total_cents"] == 9900

No fixture imports, no conftest.py — the pytest11 entry point auto-loads them.

Depends on

  • simple_module_core, simple_module_db, simple_module_hosting
  • pytest, pytest-asyncio, httpx, sqlalchemy

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_module_test-0.0.27.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_module_test-0.0.27-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file simple_module_test-0.0.27.tar.gz.

File metadata

  • Download URL: simple_module_test-0.0.27.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for simple_module_test-0.0.27.tar.gz
Algorithm Hash digest
SHA256 a4fbd48ac7c498983a9b021b3236ab9b7d954ec2818d0f8cb6b63688d7cdcbfe
MD5 eada5a2772f5916cc3762d93511a11b6
BLAKE2b-256 7fd82a3a273156366bedf8d8498f4cab4554f104ec71af80da7c4d31d1038030

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_module_test-0.0.27.tar.gz:

Publisher: release.yml on antosubash/simple_module_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simple_module_test-0.0.27-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_module_test-0.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 9678aae1672e3ec064d70b7239a56701095cd1cf51b9381e9084a6fa83dc8a5f
MD5 e70e5964bc0b04ba5712e64b41500dce
BLAKE2b-256 ef01dc9bcd834dd60c46ef7982e2a43844e0dd8e492e0bba324e86002dc46535

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_module_test-0.0.27-py3-none-any.whl:

Publisher: release.yml on antosubash/simple_module_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.33

2 files

0.0.32

2 files

0.0.31

2 files

0.0.30

2 files

0.0.29

2 files

0.0.28

2 files

This release

0.0.27 This release

2 files

0.0.26

2 files

0.0.25

2 files

0.0.24

2 files

0.0.23

2 files

0.0.22

2 files

0.0.21

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

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