Metadata-Version: 2.4
Name: pytest-orm-boundaries
Version: 0.1.0
Summary: Pytest plugin that fails your tests when ORM queries cross DDD aggregate boundaries (Django supported today).
Keywords: django,pytest,plugin,orm,ddd,aggregate,boundaries,architecture
Author: Evgeniia Chibisova
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Dist: pytest>=8
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/evchibisova/pytest-orm-boundaries
Project-URL: Repository, https://github.com/evchibisova/pytest-orm-boundaries
Project-URL: Issues, https://github.com/evchibisova/pytest-orm-boundaries/issues
Project-URL: Changelog, https://github.com/evchibisova/pytest-orm-boundaries/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# pytest-orm-boundaries

A pytest plugin that fails your tests when ORM queries cross your DDD aggregate boundaries.

Currently works with Django ORM.

In domain-driven design, an aggregate is a consistency boundary: code in one
aggregate should not reach into the internals of another. Django's `__` relation
lookups make it easy to cross those boundaries silently:

```python
# Payment and Order belong to different aggregates — this query couples them.
Purchase.objects.get(client__name="John")
```

`pytest-orm-boundaries` watches the queries your test suite executes and
reports the ones that step outside their aggregate, including `__`, subqueries and other.

## Install

```bash
pip install pytest-orm-boundaries
```

pytest picks the plugin up automatically.

## Configure

Declare your aggregates in `boundaries.toml` at the project root (or point at
the file with `--boundaries-config` / the `boundaries_config` ini option):

```toml
[aggregates]
client   = ["bookshop.Client"]
book     = ["bookshop.Book"]
purchase = ["bookshop.Purchase", "bookshop.PurchaseLine"]
```

Models are written as `app_label.Model`. Models not listed in any aggregate are
not checked. Without a config file the plugin emits a warning and runs no checks.

## Status

Alpha - testing basic version.
