Skip to content

Commit

Permalink
Merge pull request #9070 from andrewdotn/main
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Oct 5, 2021
2 parents 459e10b + a9edfdf commit fb52fc5
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ python:
- method: pip
path: .

build:
apt_packages:
- inkscape

formats:
- epub
- pdf
8 changes: 8 additions & 0 deletions doc/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# The short X.Y version.
import ast
import os
import shutil
import sys
from typing import List
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -57,6 +58,13 @@
"sphinxcontrib_trio",
]

# Building PDF docs on readthedocs requires inkscape for svg to pdf
# conversion. The relevant plugin is not useful for normal HTML builds, but
# it still raises warnings and fails CI if inkscape is not available. So
# only use the plugin if inkscape is actually available.
if shutil.which("inkscape"):
extensions.append("sphinxcontrib.inkscapeconverter")

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
10 changes: 5 additions & 5 deletions doc/en/example/fixtures/fixture_availability.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions doc/en/example/fixtures/fixture_availability_plugins.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doc/en/example/fixtures/test_fixtures_order_scope.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions doc/en/reference/fixtures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fixture (``inner``) from a scope it wasn't defined in:
From the tests' perspectives, they have no problem seeing each of the fixtures
they're dependent on:

.. image:: /example/fixtures/test_fixtures_request_different_scope.svg
.. image:: /example/fixtures/test_fixtures_request_different_scope.*
:align: center

So when they run, ``outer`` will have no problem finding ``inner``, because
Expand Down Expand Up @@ -193,7 +193,7 @@ For example, given a test file structure like this:

The boundaries of the scopes can be visualized like this:

.. image:: /example/fixtures/fixture_availability.svg
.. image:: /example/fixtures/fixture_availability.*
:align: center

The directories become their own sort of scope where fixtures that are defined
Expand Down Expand Up @@ -319,7 +319,7 @@ The test will pass because the larger scoped fixtures are executing first.

The order breaks down to this:

.. image:: /example/fixtures/test_fixtures_order_scope.svg
.. image:: /example/fixtures/test_fixtures_order_scope.*
:align: center

Fixtures of the same order execute based on dependencies
Expand All @@ -337,13 +337,13 @@ For example:

If we map out what depends on what, we get something that look like this:

.. image:: /example/fixtures/test_fixtures_order_dependencies.svg
.. image:: /example/fixtures/test_fixtures_order_dependencies.*
:align: center

The rules provided by each fixture (as to what fixture(s) each one has to come
after) are comprehensive enough that it can be flattened to this:

.. image:: /example/fixtures/test_fixtures_order_dependencies_flat.svg
.. image:: /example/fixtures/test_fixtures_order_dependencies_flat.*
:align: center

Enough information has to be provided through these requests in order for pytest
Expand All @@ -354,7 +354,7 @@ could go with any one of those interpretations at any point.

For example, if ``d`` didn't request ``c``, i.e.the graph would look like this:

.. image:: /example/fixtures/test_fixtures_order_dependencies_unclear.svg
.. image:: /example/fixtures/test_fixtures_order_dependencies_unclear.*
:align: center

Because nothing requested ``c`` other than ``g``, and ``g`` also requests ``f``,
Expand Down Expand Up @@ -395,7 +395,7 @@ So if the test file looked like this:

the graph would look like this:

.. image:: /example/fixtures/test_fixtures_order_autouse.svg
.. image:: /example/fixtures/test_fixtures_order_autouse.*
:align: center

Because ``c`` can now be put above ``d`` in the graph, pytest can once again
Expand All @@ -413,7 +413,7 @@ example, consider this file:
Even though nothing in ``TestClassWithoutC1Request`` is requesting ``c1``, it still
is executed for the tests inside it anyway:

.. image:: /example/fixtures/test_fixtures_order_autouse_multiple_scopes.svg
.. image:: /example/fixtures/test_fixtures_order_autouse_multiple_scopes.*
:align: center

But just because one autouse fixture requested a non-autouse fixture, that
Expand All @@ -428,7 +428,7 @@ For example, take a look at this test file:

It would break down to something like this:

.. image:: /example/fixtures/test_fixtures_order_autouse_temp_effects.svg
.. image:: /example/fixtures/test_fixtures_order_autouse_temp_effects.*
:align: center

For ``test_req`` and ``test_no_req`` inside ``TestClassWithAutouse``, ``c3``
Expand Down
1 change: 1 addition & 0 deletions doc/en/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pygments-pytest>=2.2.0
sphinx-removed-in>=0.2.0
sphinx>=3.1,<4
sphinxcontrib-trio
sphinxcontrib-svg2pdfconverter

0 comments on commit fb52fc5

Please sign in to comment.