Shared pytest fixtures (app, client, db_session, authenticated_client) for writing simple_module module tests
Project description
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
settings— a ready-to-useSettingsinstance with an in-memory SQLite database and multi-tenancy enabled.db_state,engine,db_session— freshDatabaseStateper test;db_sessionalso creates all module tables and stampsalembic_versionat head so the boot-time migration check passes.app— acreate_app(settings)instance withlifespanstarted and stopped.client— anhttpx.AsyncClientbound to the test app.authenticated_client— same but with an admin user seeded and a forged session cookie attached.
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_hostingpytest,pytest-asyncio,httpx,sqlalchemy
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_module_test-0.0.7.tar.gz.
File metadata
- Download URL: simple_module_test-0.0.7.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca0a8a7ea4c904ac69d178c74751f8e7171dd6ca66cebe8a9d98d60a8da46f84
|
|
| MD5 |
f493b2e77974275499c0b10c8d15bda9
|
|
| BLAKE2b-256 |
d1d8e7e32b57a9795210231812c28297d07271ed0c84709e2c4d55ae67a6e8d6
|
Provenance
The following attestation bundles were made for simple_module_test-0.0.7.tar.gz:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_test-0.0.7.tar.gz -
Subject digest:
ca0a8a7ea4c904ac69d178c74751f8e7171dd6ca66cebe8a9d98d60a8da46f84 - Sigstore transparency entry: 1428872761
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@7bd73f61e374941fbea94d67ad15518342cb5274 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7bd73f61e374941fbea94d67ad15518342cb5274 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simple_module_test-0.0.7-py3-none-any.whl.
File metadata
- Download URL: simple_module_test-0.0.7-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68ea32c1065df3a87fd4422e40aa103179e9064b5bc20ca7c627abf893eb3eda
|
|
| MD5 |
fc29fc04c1850a4f1871384827869044
|
|
| BLAKE2b-256 |
52dfa52e8b5541ce62d1ab23149fff42258461e718205e322efef2dd825589ad
|
Provenance
The following attestation bundles were made for simple_module_test-0.0.7-py3-none-any.whl:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_test-0.0.7-py3-none-any.whl -
Subject digest:
68ea32c1065df3a87fd4422e40aa103179e9064b5bc20ca7c627abf893eb3eda - Sigstore transparency entry: 1428872764
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@7bd73f61e374941fbea94d67ad15518342cb5274 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7bd73f61e374941fbea94d67ad15518342cb5274 -
Trigger Event:
workflow_dispatch
-
Statement type: