@@ -1188,12 +1188,12 @@ long as the test requesting them can see all fixtures involved.
1188
1188
For example, here's a test file with a fixture (``outer ``) that requests a
1189
1189
fixture (``inner ``) from a scope it wasn't defined in:
1190
1190
1191
- .. literalinclude :: example/fixtures/test_fixtures_request_different_scope.py
1191
+ .. literalinclude :: / example/fixtures/test_fixtures_request_different_scope.py
1192
1192
1193
1193
From the tests' perspectives, they have no problem seeing each of the fixtures
1194
1194
they're dependent on:
1195
1195
1196
- .. image :: example/fixtures/test_fixtures_request_different_scope.svg
1196
+ .. image :: / example/fixtures/test_fixtures_request_different_scope.svg
1197
1197
:align: center
1198
1198
1199
1199
So when they run, ``outer `` will have no problem finding ``inner ``, because
@@ -1270,7 +1270,7 @@ For example, given a test file structure like this:
1270
1270
1271
1271
The boundaries of the scopes can be visualized like this:
1272
1272
1273
- .. image :: example/fixtures/fixture_availability.svg
1273
+ .. image :: / example/fixtures/fixture_availability.svg
1274
1274
:align: center
1275
1275
1276
1276
The directories become their own sort of scope where fixtures that are defined
@@ -1346,7 +1346,7 @@ If ``plugin_a`` is installed and provides the fixture ``a_fix``, and
1346
1346
``plugin_b `` is installed and provides the fixture ``b_fix ``, then this is what
1347
1347
the test's search for fixtures would look like:
1348
1348
1349
- .. image :: example/fixtures/fixture_availability_plugins.svg
1349
+ .. image :: / example/fixtures/fixture_availability_plugins.svg
1350
1350
:align: center
1351
1351
1352
1352
pytest will only search for ``a_fix `` and ``b_fix `` in the plugins after
@@ -1401,13 +1401,13 @@ Within a function request for fixtures, those of higher-scopes (such as
1401
1401
1402
1402
Here's an example:
1403
1403
1404
- .. literalinclude :: example/fixtures/test_fixtures_order_scope.py
1404
+ .. literalinclude :: / example/fixtures/test_fixtures_order_scope.py
1405
1405
1406
1406
The test will pass because the larger scoped fixtures are executing first.
1407
1407
1408
1408
The order breaks down to this:
1409
1409
1410
- .. image :: example/fixtures/test_fixtures_order_scope.svg
1410
+ .. image :: / example/fixtures/test_fixtures_order_scope.svg
1411
1411
:align: center
1412
1412
1413
1413
Fixtures of the same order execute based on dependencies
@@ -1421,17 +1421,17 @@ sure it is executed after ``b``.
1421
1421
1422
1422
For example:
1423
1423
1424
- .. literalinclude :: example/fixtures/test_fixtures_order_dependencies.py
1424
+ .. literalinclude :: / example/fixtures/test_fixtures_order_dependencies.py
1425
1425
1426
1426
If we map out what depends on what, we get something that look like this:
1427
1427
1428
- .. image :: example/fixtures/test_fixtures_order_dependencies.svg
1428
+ .. image :: / example/fixtures/test_fixtures_order_dependencies.svg
1429
1429
:align: center
1430
1430
1431
1431
The rules provided by each fixture (as to what fixture(s) each one has to come
1432
1432
after) are comprehensive enough that it can be flattened to this:
1433
1433
1434
- .. image :: example/fixtures/test_fixtures_order_dependencies_flat.svg
1434
+ .. image :: / example/fixtures/test_fixtures_order_dependencies_flat.svg
1435
1435
:align: center
1436
1436
1437
1437
Enough information has to be provided through these requests in order for pytest
@@ -1442,7 +1442,7 @@ could go with any one of those interpretations at any point.
1442
1442
1443
1443
For example, if ``d `` didn't request ``c ``, i.e.the graph would look like this:
1444
1444
1445
- .. image :: example/fixtures/test_fixtures_order_dependencies_unclear.svg
1445
+ .. image :: / example/fixtures/test_fixtures_order_dependencies_unclear.svg
1446
1446
:align: center
1447
1447
1448
1448
Because nothing requested ``c `` other than ``g ``, and ``g `` also requests ``f ``,
@@ -1479,11 +1479,11 @@ non-autouse fixtures within that scope.
1479
1479
1480
1480
So if the test file looked like this:
1481
1481
1482
- .. literalinclude :: example/fixtures/test_fixtures_order_autouse.py
1482
+ .. literalinclude :: / example/fixtures/test_fixtures_order_autouse.py
1483
1483
1484
1484
the graph would look like this:
1485
1485
1486
- .. image :: example/fixtures/test_fixtures_order_autouse.svg
1486
+ .. image :: / example/fixtures/test_fixtures_order_autouse.svg
1487
1487
:align: center
1488
1488
1489
1489
Because ``c `` can now be put above ``d `` in the graph, pytest can once again
@@ -1496,12 +1496,12 @@ Be careful with autouse, though, as an autouse fixture will automatically
1496
1496
execute for every test that can reach it, even if they don't request it. For
1497
1497
example, consider this file:
1498
1498
1499
- .. literalinclude :: example/fixtures/test_fixtures_order_autouse_multiple_scopes.py
1499
+ .. literalinclude :: / example/fixtures/test_fixtures_order_autouse_multiple_scopes.py
1500
1500
1501
1501
Even though nothing in ``TestClassWithC1Request `` is requesting ``c1 ``, it still
1502
1502
is executed for the tests inside it anyway:
1503
1503
1504
- .. image :: example/fixtures/test_fixtures_order_autouse_multiple_scopes.svg
1504
+ .. image :: / example/fixtures/test_fixtures_order_autouse_multiple_scopes.svg
1505
1505
:align: center
1506
1506
1507
1507
But just because one autouse fixture requested a non-autouse fixture, that
@@ -1512,11 +1512,11 @@ fixture) can apply to.
1512
1512
1513
1513
For example, take a look at this test file:
1514
1514
1515
- .. literalinclude :: example/fixtures/test_fixtures_order_autouse_temp_effects.py
1515
+ .. literalinclude :: / example/fixtures/test_fixtures_order_autouse_temp_effects.py
1516
1516
1517
1517
It would break down to something like this:
1518
1518
1519
- .. image :: example/fixtures/test_fixtures_order_autouse_temp_effects.svg
1519
+ .. image :: / example/fixtures/test_fixtures_order_autouse_temp_effects.svg
1520
1520
:align: center
1521
1521
1522
1522
For ``test_req `` and ``test_no_req `` inside ``TestClassWithAutouse ``, ``c3 ``
0 commit comments