We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 29f81c5 + d8c7b0b commit d5886b8Copy full SHA for d5886b8
README.md
@@ -186,6 +186,32 @@ def test_database():
186
...
187
```
188
189
+### Chaining fixtures
190
+
191
+Fixtures that use other fixtures should be decorated with `@use`, so
192
+that fixture dependencies are chained.
193
194
+```python
195
+@use("db")
196
+def parent_fixture():
197
+ daedalus = Person.objects.create(name='Daedalus')
198
+ yield daedalus
199
+ daedalus.delete()
200
201
+@use(parent_fixture)
202
+@fixture
203
+def child_fixture():
204
+ daedalus = parent_fixture()
205
+ icarus = Person.objects.create(name='Icarus', father=daedalus)
206
+ yield
207
208
+@use(child_fixture)
209
+def test_flight():
210
+ flyers = Person.objects.all()
211
+ ...
212
+```
213
214
215
## Running the `unmagic` test suite
216
217
```sh
0 commit comments