pytest-orm-boundaries 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/PKG-INFO +22 -12
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/README.md +21 -11
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/pyproject.toml +1 -1
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/guard.py +6 -1
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/LICENSE +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/__init__.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/allows.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/callstack.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/config.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/crossings.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/ignores.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/model_resolution.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/plugin.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/prefetch_resolution.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/report.py +0 -0
- {pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/sql_parsing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-orm-boundaries
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Pytest plugin that fails tests when ORM queries cross DDD aggregate boundaries (Django supported today).
|
|
5
5
|
Keywords: django,pytest,plugin,orm,ddd,aggregate,boundaries,architecture
|
|
6
6
|
Author: Evgeniia Chibisova
|
|
@@ -50,14 +50,22 @@ and reports access that crosses a configured boundary - through `__` lookups,
|
|
|
50
50
|
|
|
51
51
|
## Install
|
|
52
52
|
|
|
53
|
-
Install the plugin
|
|
53
|
+
Install the plugin in your Django project:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
pip install
|
|
56
|
+
pip install pytest-orm-boundaries
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
pytest discovers the plugin automatically.
|
|
60
60
|
|
|
61
|
+
The plugin uses the Django version already installed by your project. If you are
|
|
62
|
+
installing into an environment without Django and want pip to install it too,
|
|
63
|
+
use the optional extra:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install "pytest-orm-boundaries[django]"
|
|
67
|
+
```
|
|
68
|
+
|
|
61
69
|
## Configure
|
|
62
70
|
|
|
63
71
|
Declare your aggregates and their Django models in `boundaries.toml` at the project
|
|
@@ -151,18 +159,21 @@ Places are ordered by how many tests they affect. Pass `-v` to see every affecte
|
|
|
151
159
|
|
|
152
160
|
## Allow and ignore
|
|
153
161
|
|
|
154
|
-
CQRS read models may cross boundaries
|
|
162
|
+
CQRS read models may cross aggregate boundaries by design, while existing
|
|
163
|
+
application code may contain crossings you want to fix over time. `[allow]` and
|
|
164
|
+
`[ignore]` let you tell the plugin which is which:
|
|
155
165
|
|
|
156
166
|
- `[allow]` - the crossing is **intentional**. Use it for code that is meant to
|
|
157
|
-
span aggregates, such as CQRS read models
|
|
158
|
-
|
|
167
|
+
span aggregates, such as CQRS read models. An allowed crossing is suppressed
|
|
168
|
+
and never reported.
|
|
159
169
|
- `[ignore]` - the crossing is **known debt** you plan to fix. It is suppressed
|
|
160
|
-
|
|
170
|
+
and the plugin reports the entry when its matching code runs without a
|
|
171
|
+
crossing.
|
|
161
172
|
|
|
162
173
|
```toml
|
|
163
174
|
[allow]
|
|
164
175
|
files = [
|
|
165
|
-
"app/
|
|
176
|
+
"app/read_models/sales.py",
|
|
166
177
|
]
|
|
167
178
|
|
|
168
179
|
[ignore]
|
|
@@ -178,13 +189,12 @@ resolved relative to pytest's root directory and matched against either:
|
|
|
178
189
|
- the file that issues the query, or
|
|
179
190
|
- the test file.
|
|
180
191
|
|
|
181
|
-
An `[ignore]` whose
|
|
182
|
-
boundary is stale
|
|
192
|
+
An `[ignore]` whose matching code runs through the whole suite without crossing
|
|
193
|
+
a boundary is stale, so the plugin lists it for removal:
|
|
183
194
|
|
|
184
195
|
```
|
|
185
196
|
======================= orm-boundaries: stale ignores ========================
|
|
186
|
-
These [ignore] entries
|
|
187
|
-
Remove them from boundaries.toml:
|
|
197
|
+
These [ignore] entries matched files that ran without crossing a boundary. Remove them from boundaries.toml:
|
|
188
198
|
- app/billing.py
|
|
189
199
|
```
|
|
190
200
|
|
|
@@ -21,14 +21,22 @@ and reports access that crosses a configured boundary - through `__` lookups,
|
|
|
21
21
|
|
|
22
22
|
## Install
|
|
23
23
|
|
|
24
|
-
Install the plugin
|
|
24
|
+
Install the plugin in your Django project:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
pip install
|
|
27
|
+
pip install pytest-orm-boundaries
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
pytest discovers the plugin automatically.
|
|
31
31
|
|
|
32
|
+
The plugin uses the Django version already installed by your project. If you are
|
|
33
|
+
installing into an environment without Django and want pip to install it too,
|
|
34
|
+
use the optional extra:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install "pytest-orm-boundaries[django]"
|
|
38
|
+
```
|
|
39
|
+
|
|
32
40
|
## Configure
|
|
33
41
|
|
|
34
42
|
Declare your aggregates and their Django models in `boundaries.toml` at the project
|
|
@@ -122,18 +130,21 @@ Places are ordered by how many tests they affect. Pass `-v` to see every affecte
|
|
|
122
130
|
|
|
123
131
|
## Allow and ignore
|
|
124
132
|
|
|
125
|
-
CQRS read models may cross boundaries
|
|
133
|
+
CQRS read models may cross aggregate boundaries by design, while existing
|
|
134
|
+
application code may contain crossings you want to fix over time. `[allow]` and
|
|
135
|
+
`[ignore]` let you tell the plugin which is which:
|
|
126
136
|
|
|
127
137
|
- `[allow]` - the crossing is **intentional**. Use it for code that is meant to
|
|
128
|
-
span aggregates, such as CQRS read models
|
|
129
|
-
|
|
138
|
+
span aggregates, such as CQRS read models. An allowed crossing is suppressed
|
|
139
|
+
and never reported.
|
|
130
140
|
- `[ignore]` - the crossing is **known debt** you plan to fix. It is suppressed
|
|
131
|
-
|
|
141
|
+
and the plugin reports the entry when its matching code runs without a
|
|
142
|
+
crossing.
|
|
132
143
|
|
|
133
144
|
```toml
|
|
134
145
|
[allow]
|
|
135
146
|
files = [
|
|
136
|
-
"app/
|
|
147
|
+
"app/read_models/sales.py",
|
|
137
148
|
]
|
|
138
149
|
|
|
139
150
|
[ignore]
|
|
@@ -149,13 +160,12 @@ resolved relative to pytest's root directory and matched against either:
|
|
|
149
160
|
- the file that issues the query, or
|
|
150
161
|
- the test file.
|
|
151
162
|
|
|
152
|
-
An `[ignore]` whose
|
|
153
|
-
boundary is stale
|
|
163
|
+
An `[ignore]` whose matching code runs through the whole suite without crossing
|
|
164
|
+
a boundary is stale, so the plugin lists it for removal:
|
|
154
165
|
|
|
155
166
|
```
|
|
156
167
|
======================= orm-boundaries: stale ignores ========================
|
|
157
|
-
These [ignore] entries
|
|
158
|
-
Remove them from boundaries.toml:
|
|
168
|
+
These [ignore] entries matched files that ran without crossing a boundary. Remove them from boundaries.toml:
|
|
159
169
|
- app/billing.py
|
|
160
170
|
```
|
|
161
171
|
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pytest-orm-boundaries"
|
|
7
|
-
version = "0.7.
|
|
7
|
+
version = "0.7.2"
|
|
8
8
|
description = "Pytest plugin that fails tests when ORM queries cross DDD aggregate boundaries (Django supported today)."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/guard.py
RENAMED
|
@@ -170,7 +170,12 @@ class BoundaryGuard:
|
|
|
170
170
|
"""Map one prefetch to the model pair per relation step and check them."""
|
|
171
171
|
if not model_instances:
|
|
172
172
|
return
|
|
173
|
-
|
|
173
|
+
from django.db.models import Model
|
|
174
|
+
|
|
175
|
+
first = model_instances[0]
|
|
176
|
+
if not isinstance(first, Model):
|
|
177
|
+
return
|
|
178
|
+
source_model = type(first)
|
|
174
179
|
step_model_pairs = resolve_prefetch_step_models(
|
|
175
180
|
source_model=source_model, lookups=lookups
|
|
176
181
|
)
|
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/__init__.py
RENAMED
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/allows.py
RENAMED
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/callstack.py
RENAMED
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/config.py
RENAMED
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/crossings.py
RENAMED
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/ignores.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/plugin.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/report.py
RENAMED
|
File without changes
|
{pytest_orm_boundaries-0.7.0 → pytest_orm_boundaries-0.7.2}/src/pytest_orm_boundaries/sql_parsing.py
RENAMED
|
File without changes
|