Merge pull request #9070 from andrewdotn/main

This commit is contained in:
Bruno Oliveira 2021-10-05 16:51:58 -03:00 committed by GitHub
commit fb52fc5163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 32 deletions

View File

@ -7,6 +7,10 @@ python:
- method: pip - method: pip
path: . path: .
build:
apt_packages:
- inkscape
formats: formats:
- epub - epub
- pdf - pdf

View File

@ -17,6 +17,7 @@
# The short X.Y version. # The short X.Y version.
import ast import ast
import os import os
import shutil
import sys import sys
from typing import List from typing import List
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -57,6 +58,13 @@ extensions = [
"sphinxcontrib_trio", "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. # Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"] templates_path = ["_templates"]

View File

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="572" height="542"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="572" height="542">
<style> <style>
text { text {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
@ -37,7 +37,7 @@
<path d="M 26,271 A 260 260 0 0 1 546 271" id="testp"/> <path d="M 26,271 A 260 260 0 0 1 546 271" id="testp"/>
</defs> </defs>
<text class="package"> <text class="package">
<textPath href="#testp" startOffset="50%">tests</textPath> <textPath xlink:href="#testp" startOffset="50%">tests</textPath>
</text> </text>
<!-- subpackage --> <!-- subpackage -->
@ -47,7 +47,7 @@
<path d="M 56,271 A 130 130 0 0 1 316 271" id="subpackage"/> <path d="M 56,271 A 130 130 0 0 1 316 271" id="subpackage"/>
</defs> </defs>
<text class="package"> <text class="package">
<textPath href="#subpackage" startOffset="50%">subpackage</textPath> <textPath xlink:href="#subpackage" startOffset="50%">subpackage</textPath>
</text> </text>
<!-- test_subpackage.py --> <!-- test_subpackage.py -->
@ -57,7 +57,7 @@
<path d="M 106,311 A 80 80 0 0 1 266 311" id="testSubpackage"/> <path d="M 106,311 A 80 80 0 0 1 266 311" id="testSubpackage"/>
</defs> </defs>
<text class="module"> <text class="module">
<textPath href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath> <textPath xlink:href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath>
</text> </text>
<!-- innermost --> <!-- innermost -->
<line x1="186" x2="186" y1="271" y2="351"/> <line x1="186" x2="186" y1="271" y2="351"/>
@ -102,7 +102,7 @@
<path d="M 366,271 A 75 75 0 0 1 516 271" id="testTop"/> <path d="M 366,271 A 75 75 0 0 1 516 271" id="testTop"/>
</defs> </defs>
<text class="module"> <text class="module">
<textPath href="#testTop" startOffset="50%">test_top.py</textPath> <textPath xlink:href="#testTop" startOffset="50%">test_top.py</textPath>
</text> </text>
<!-- innermost --> <!-- innermost -->
<line x1="441" x2="441" y1="306" y2="236"/> <line x1="441" x2="441" y1="306" y2="236"/>

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="587" height="382"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="587" height="382">
<style> <style>
text { text {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
@ -38,7 +38,7 @@
<path d="M 411,86 A 75 75 0 0 1 561 86" id="pluginA"/> <path d="M 411,86 A 75 75 0 0 1 561 86" id="pluginA"/>
</defs> </defs>
<text class="plugin"> <text class="plugin">
<textPath href="#pluginA" startOffset="50%">plugin_a</textPath> <textPath xlink:href="#pluginA" startOffset="50%">plugin_a</textPath>
</text> </text>
<!-- scope order number --> <!-- scope order number -->
<mask id="pluginAOrderMask"> <mask id="pluginAOrderMask">
@ -55,7 +55,7 @@
<path d="M 411,296 A 75 75 0 0 1 561 296" id="pluginB"/> <path d="M 411,296 A 75 75 0 0 1 561 296" id="pluginB"/>
</defs> </defs>
<text class="plugin"> <text class="plugin">
<textPath href="#pluginB" startOffset="50%">plugin_b</textPath> <textPath xlink:href="#pluginB" startOffset="50%">plugin_b</textPath>
</text> </text>
<!-- scope order number --> <!-- scope order number -->
<mask id="pluginBOrderMask"> <mask id="pluginBOrderMask">
@ -72,7 +72,7 @@
<path d="M 11,191 A 180 180 0 0 1 371 191" id="testp"/> <path d="M 11,191 A 180 180 0 0 1 371 191" id="testp"/>
</defs> </defs>
<text class="package"> <text class="package">
<textPath href="#testp" startOffset="50%">tests</textPath> <textPath xlink:href="#testp" startOffset="50%">tests</textPath>
</text> </text>
<!-- scope order number --> <!-- scope order number -->
<mask id="mainOrderMask"> <mask id="mainOrderMask">
@ -89,7 +89,7 @@
<path d="M 61,231 A 130 130 0 0 1 321 231" id="subpackage"/> <path d="M 61,231 A 130 130 0 0 1 321 231" id="subpackage"/>
</defs> </defs>
<text class="package"> <text class="package">
<textPath href="#subpackage" startOffset="50%">subpackage</textPath> <textPath xlink:href="#subpackage" startOffset="50%">subpackage</textPath>
</text> </text>
<!-- scope order number --> <!-- scope order number -->
<mask id="subpackageOrderMask"> <mask id="subpackageOrderMask">
@ -106,7 +106,7 @@
<path d="M 111,271 A 80 80 0 0 1 271 271" id="testSubpackage"/> <path d="M 111,271 A 80 80 0 0 1 271 271" id="testSubpackage"/>
</defs> </defs>
<text class="module"> <text class="module">
<textPath href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath> <textPath xlink:href="#testSubpackage" startOffset="50%">test_subpackage.py</textPath>
</text> </text>
<!-- scope order number --> <!-- scope order number -->
<mask id="testSubpackageOrderMask"> <mask id="testSubpackageOrderMask">

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="862" height="402"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="862" height="402">
<style> <style>
text { text {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
@ -48,7 +48,7 @@
<path d="M31,201 A 190 190 0 0 1 411 201" id="testClassWith"/> <path d="M31,201 A 190 190 0 0 1 411 201" id="testClassWith"/>
</defs> </defs>
<text class="class"> <text class="class">
<textPath href="#testClassWith" startOffset="50%">TestWithC1Request</textPath> <textPath xlink:href="#testClassWith" startOffset="50%">TestWithC1Request</textPath>
</text> </text>
<!-- TestWithoutC1Request --> <!-- TestWithoutC1Request -->
@ -67,7 +67,7 @@
<path d="M451,201 A 190 190 0 0 1 831 201" id="testClassWithout"/> <path d="M451,201 A 190 190 0 0 1 831 201" id="testClassWithout"/>
</defs> </defs>
<text class="class"> <text class="class">
<textPath href="#testClassWithout" startOffset="50%">TestWithoutC1Request</textPath> <textPath xlink:href="#testClassWithout" startOffset="50%">TestWithoutC1Request</textPath>
</text> </text>
<rect class="autouse" width="862" height="40" x="1" y="181" /> <rect class="autouse" width="862" height="40" x="1" y="181" />

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="862" height="502"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="862" height="502">
<style> <style>
text { text {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
@ -39,7 +39,7 @@
<path d="M11,251 A 240 240 0 0 1 491 251" id="testClassWith"/> <path d="M11,251 A 240 240 0 0 1 491 251" id="testClassWith"/>
</defs> </defs>
<text class="class"> <text class="class">
<textPath href="#testClassWith" startOffset="50%">TestWithAutouse</textPath> <textPath xlink:href="#testClassWith" startOffset="50%">TestWithAutouse</textPath>
</text> </text>
<mask id="autouseScope"> <mask id="autouseScope">
<circle fill="white" r="249" cx="251" cy="251" /> <circle fill="white" r="249" cx="251" cy="251" />
@ -79,7 +79,7 @@
<path d="M 531,251 A 160 160 0 0 1 851 251" id="testClassWithout"/> <path d="M 531,251 A 160 160 0 0 1 851 251" id="testClassWithout"/>
</defs> </defs>
<text class="class"> <text class="class">
<textPath href="#testClassWithout" startOffset="50%">TestWithoutAutouse</textPath> <textPath xlink:href="#testClassWithout" startOffset="50%">TestWithoutAutouse</textPath>
</text> </text>
<!-- TestWithoutAutouse.test_req --> <!-- TestWithoutAutouse.test_req -->

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="262" height="537"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="262" height="537">
<style> <style>
text { text {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
@ -50,6 +50,6 @@
<path d="M131,526 A 120 120 0 0 1 136 286" id="testClass"/> <path d="M131,526 A 120 120 0 0 1 136 286" id="testClass"/>
</defs> </defs>
<text class="class"> <text class="class">
<textPath href="#testClass" startOffset="50%">TestClass</textPath> <textPath xlink:href="#testClass" startOffset="50%">TestClass</textPath>
</text> </text>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="562" height="532"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="562" height="532">
<style> <style>
text { text {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
@ -41,7 +41,7 @@
<path d="M 26,266 A 255 255 0 0 1 536 266" id="testModule"/> <path d="M 26,266 A 255 255 0 0 1 536 266" id="testModule"/>
</defs> </defs>
<text class="module"> <text class="module">
<textPath href="#testModule" startOffset="50%">test_fixtures_request_different_scope.py</textPath> <textPath xlink:href="#testModule" startOffset="50%">test_fixtures_request_different_scope.py</textPath>
</text> </text>
<!-- TestOne --> <!-- TestOne -->
@ -61,7 +61,7 @@
<path d="M 51,266 A 90 90 0 0 1 231 266" id="testOne"/> <path d="M 51,266 A 90 90 0 0 1 231 266" id="testOne"/>
</defs> </defs>
<text class="class"> <text class="class">
<textPath href="#testOne" startOffset="50%">TestOne</textPath> <textPath xlink:href="#testOne" startOffset="50%">TestOne</textPath>
</text> </text>
<!-- scope order number --> <!-- scope order number -->
<mask id="testOneOrderMask"> <mask id="testOneOrderMask">
@ -95,7 +95,7 @@
<path d="M 331,266 A 90 90 0 0 1 511 266" id="testTwo"/> <path d="M 331,266 A 90 90 0 0 1 511 266" id="testTwo"/>
</defs> </defs>
<text class="class"> <text class="class">
<textPath href="#testTwo" startOffset="50%">TestTwo</textPath> <textPath xlink:href="#testTwo" startOffset="50%">TestTwo</textPath>
</text> </text>
<!-- scope order number --> <!-- scope order number -->
<mask id="testTwoOrderMask"> <mask id="testTwoOrderMask">

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -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 From the tests' perspectives, they have no problem seeing each of the fixtures
they're dependent on: they're dependent on:
.. image:: /example/fixtures/test_fixtures_request_different_scope.svg .. image:: /example/fixtures/test_fixtures_request_different_scope.*
:align: center :align: center
So when they run, ``outer`` will have no problem finding ``inner``, because So when they run, ``outer`` will have no problem finding ``inner``, because
@ -193,7 +193,7 @@ For example, given a test file structure like this:
The boundaries of the scopes can be visualized 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 :align: center
The directories become their own sort of scope where fixtures that are defined The directories become their own sort of scope where fixtures that are defined
@ -319,7 +319,7 @@ The test will pass because the larger scoped fixtures are executing first.
The order breaks down to this: The order breaks down to this:
.. image:: /example/fixtures/test_fixtures_order_scope.svg .. image:: /example/fixtures/test_fixtures_order_scope.*
:align: center :align: center
Fixtures of the same order execute based on dependencies Fixtures of the same order execute based on dependencies
@ -337,13 +337,13 @@ For example:
If we map out what depends on what, we get something that look like this: 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 :align: center
The rules provided by each fixture (as to what fixture(s) each one has to come 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: 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 :align: center
Enough information has to be provided through these requests in order for pytest Enough information has to be provided through these requests in order for pytest
@ -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: 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 :align: center
Because nothing requested ``c`` other than ``g``, and ``g`` also requests ``f``, Because nothing requested ``c`` other than ``g``, and ``g`` also requests ``f``,
@ -395,7 +395,7 @@ So if the test file looked like this:
the graph would look 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 :align: center
Because ``c`` can now be put above ``d`` in the graph, pytest can once again Because ``c`` can now be put above ``d`` in the graph, pytest can once again
@ -413,7 +413,7 @@ example, consider this file:
Even though nothing in ``TestClassWithoutC1Request`` is requesting ``c1``, it still Even though nothing in ``TestClassWithoutC1Request`` is requesting ``c1``, it still
is executed for the tests inside it anyway: 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 :align: center
But just because one autouse fixture requested a non-autouse fixture, that But just because one autouse fixture requested a non-autouse fixture, that
@ -428,7 +428,7 @@ For example, take a look at this test file:
It would break down to something like this: 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 :align: center
For ``test_req`` and ``test_no_req`` inside ``TestClassWithAutouse``, ``c3`` For ``test_req`` and ``test_no_req`` inside ``TestClassWithAutouse``, ``c3``

View File

@ -4,3 +4,4 @@ pygments-pytest>=2.2.0
sphinx-removed-in>=0.2.0 sphinx-removed-in>=0.2.0
sphinx>=3.1,<4 sphinx>=3.1,<4
sphinxcontrib-trio sphinxcontrib-trio
sphinxcontrib-svg2pdfconverter