pytest-misata
pytest fixtures for Misata: deterministic, referentially-intact, multi-table test data in one line. No factories to maintain, no fixtures.json to hand-edit, no flaky random rows.
pip install pytest-misata
Five lines to seeded tests
def test_every_order_has_a_user(misata_tables):
tables = misata_tables({
"users": {"id": {"type": "integer", "primary_key": True},
"email": {"type": "email"}},
"orders": {"id": {"type": "integer", "primary_key": True},
"user_id": {"type": "integer",
"foreign_key": {"table": "users", "column": "id"}},
"amount": {"type": "float", "min": 5, "max": 500}},
}, seed=7, rows=200)
assert set(tables["orders"]["user_id"]) <= set(tables["users"]["id"])
The FK containment assertion above is not a hope: Misata guarantees it at generation time, for every relationship, every run.
The fixtures
misata_tables(spec, seed=42, rows=None)
Returns {table_name: DataFrame}. Accepts three spec forms:
- a dict schema (shown above),
- a
SchemaConfigyou built or loaded from YAML, - a plain-English story:
misata_tables("a SaaS with users and subscriptions", rows=500).
Session-scoped cache: fifty tests sharing one schema pay for one generation. Each call returns copies, so a test that mutates its frames cannot poison the next test.
misata_db(spec, seed=42, rows=None)
Same specs, but the tables land in a temporary SQLite database and you get the URL back:
from sqlalchemy import create_engine, text
def test_app_against_real_rows(misata_db):
db_url = misata_db(SCHEMA, seed=7, rows=500)
with create_engine(db_url).connect() as conn:
n = conn.execute(text("SELECT COUNT(*) FROM users")).scalar()
assert n == 500
Function-scoped: every test gets its own database file under pytest's tmp_path, so writes never leak between tests.
Why not factory_boy or hand-rolled fixtures?
Factories build one row at a time and know nothing about the rows around them, so the classic seed-data defects creep in: orders that ship before they are placed, totals that fail their own arithmetic, foreign keys pointing nowhere. Misata generates the whole relational story at once with those invariants enforced, then audits its own output before returning it. Run misata audit on your current seed directory if you want to see the difference measured.
Determinism contract
Same spec plus same seed produces the same bytes on every machine, every run, with no network and no API keys. Change the seed to rotate the whole dataset without touching a single assertion about declared properties.
License
MIT. The engine is misata, also MIT.
Metadata
Release files for pytest-misata 0.1.0
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 |
|---|---|---|---|---|
| pytest_misata-0.1.0.tar.gz | 5.6 kB | With provenance | Details for pytest_misata-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_misata-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_misata-0.1.0-py3-none-any.whl |
Total release size: 10.5 kB
Release files / pytest_misata-0.1.0.tar.gz
| Download URL | pytest_misata-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1da790e944811c755376c3430c93f62e3bd8ea6b59732a3d5565b3421ddc4476
|
|
BLAKE2b-256 checksum How to use checksums |
68c25e789506ba217fec01dd367443fc901542e808c340ff713f8ed0ce7cc335
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 15, 2026.
Transparency logRelease files / pytest_misata-0.1.0-py3-none-any.whl
| Download URL | pytest_misata-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
913b5eee4b80732e45456bc17b247ccb6f9b8c7262dd8890937f595365ac3180
|
|
BLAKE2b-256 checksum How to use checksums |
9241e651b28d84fbbd97a3f16499412a75009b44241bd79cd5692ad5fc33466a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 15, 2026.
Transparency logSecurity for pytest-misata 0.1.0
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 pytest_misata-0.1.0.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 Jul 15, 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.