Skip to content

Commit 32ad70d

Browse files
authored
Merge pull request #8433 from evildmp/evolutionary-documentation-restructure
Added how-to and reference directories.
2 parents 4b7edef + d869541 commit 32ad70d

28 files changed

+71
-65
lines changed

changelog/5105.doc.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add automatically generated :doc:`plugin_list`. The list is updated on a periodic schedule.
1+
Add automatically generated :ref:`plugin-list`. The list is updated on a periodic schedule.

doc/en/contents.rst

+23-23
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ How-to guides
2323
.. toctree::
2424
:maxdepth: 2
2525

26-
usage
27-
existingtestsuite
28-
assert
29-
mark
30-
monkeypatch
31-
tmpdir
32-
capture
33-
skipping
34-
parametrize
35-
plugins
36-
nose
37-
bash-completion
26+
how-to/usage
27+
how-to/existingtestsuite
28+
how-to/assert
29+
how-to/mark
30+
how-to/monkeypatch
31+
how-to/tmpdir
32+
how-to/capture
33+
how-to/skipping
34+
how-to/parametrize
35+
how-to/plugins
36+
how-to/nose
37+
how-to/bash-completion
3838

3939

4040
Reference guides
@@ -43,17 +43,17 @@ Reference guides
4343
.. toctree::
4444
:maxdepth: 2
4545

46-
fixture
47-
warnings
48-
doctest
49-
cache
50-
unittest
51-
xunit_setup
52-
plugin_list
53-
writing_plugins
54-
logging
55-
customize
56-
reference
46+
reference/fixture
47+
reference/warnings
48+
reference/doctest
49+
reference/cache
50+
reference/unittest
51+
reference/xunit_setup
52+
reference/plugin_list
53+
reference/writing_plugins
54+
reference/logging
55+
reference/customize
56+
reference/reference
5757

5858

5959
Further topics

doc/en/example/index.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ answers.
1313

1414
For basic examples, see
1515

16-
- :doc:`../getting-started` for basic introductory examples
16+
- :ref:`get-started` for basic introductory examples
1717
- :ref:`assert` for basic assertion examples
1818
- :ref:`Fixtures <fixtures>` for basic fixture/setup examples
1919
- :ref:`parametrize` for basic test function parametrization
20-
- :doc:`../unittest` for basic unittest integration
21-
- :doc:`../nose` for basic nosetests integration
20+
- :ref:`unittest` for basic unittest integration
21+
- :ref:`noseintegration` for basic nosetests integration
2222

2323
The following examples aim at various use cases you might encounter.
2424

doc/en/getting-started.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _get-started:
2+
13
Get Started
24
===================================
35

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

doc/en/monkeypatch.rst doc/en/how-to/monkeypatch.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.. _monkeypatching:
12

23
How to monkeypatch/mock modules and environments
34
================================================================
File renamed without changes.
File renamed without changes.

doc/en/plugins.rst doc/en/how-to/plugins.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Here is a little annotated list for some popular plugins:
5858

5959
To see a complete list of all plugins with their latest testing
6060
status against different pytest and Python versions, please visit
61-
:doc:`plugin_list`.
61+
:ref:`plugin-list`.
6262

6363
You may also discover more plugins through a `pytest- pypi.org search`_.
6464

doc/en/skipping.rst doc/en/how-to/skipping.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ Examples
365365

366366
Here is a simple test file with the several usages:
367367

368-
.. literalinclude:: example/xfail_demo.py
368+
.. literalinclude:: /example/xfail_demo.py
369369

370370
Running it with the report-on-xfail option gives this output:
371371

File renamed without changes.
File renamed without changes.

doc/en/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Features
8181

8282
- Python 3.6+ and PyPy 3
8383

84-
- Rich plugin architecture, with over 800+ :doc:`external plugins <plugin_list>` and thriving community
84+
- Rich plugin architecture, with over 800+ :ref:`external plugins <plugin-list>` and thriving community
8585

8686

8787
Documentation
File renamed without changes.
File renamed without changes.

doc/en/doctest.rst doc/en/reference/doctest.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.. _doctest:
12

23
Doctest integration for modules and test files
34
=========================================================

doc/en/fixture.rst doc/en/reference/fixture.rst

+16-16
Original file line numberDiff line numberDiff line change
@@ -1188,12 +1188,12 @@ long as the test requesting them can see all fixtures involved.
11881188
For example, here's a test file with a fixture (``outer``) that requests a
11891189
fixture (``inner``) from a scope it wasn't defined in:
11901190

1191-
.. literalinclude:: example/fixtures/test_fixtures_request_different_scope.py
1191+
.. literalinclude:: /example/fixtures/test_fixtures_request_different_scope.py
11921192

11931193
From the tests' perspectives, they have no problem seeing each of the fixtures
11941194
they're dependent on:
11951195

1196-
.. image:: example/fixtures/test_fixtures_request_different_scope.svg
1196+
.. image:: /example/fixtures/test_fixtures_request_different_scope.svg
11971197
:align: center
11981198

11991199
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:
12701270

12711271
The boundaries of the scopes can be visualized like this:
12721272

1273-
.. image:: example/fixtures/fixture_availability.svg
1273+
.. image:: /example/fixtures/fixture_availability.svg
12741274
:align: center
12751275

12761276
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
13461346
``plugin_b`` is installed and provides the fixture ``b_fix``, then this is what
13471347
the test's search for fixtures would look like:
13481348

1349-
.. image:: example/fixtures/fixture_availability_plugins.svg
1349+
.. image:: /example/fixtures/fixture_availability_plugins.svg
13501350
:align: center
13511351

13521352
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
14011401

14021402
Here's an example:
14031403

1404-
.. literalinclude:: example/fixtures/test_fixtures_order_scope.py
1404+
.. literalinclude:: /example/fixtures/test_fixtures_order_scope.py
14051405

14061406
The test will pass because the larger scoped fixtures are executing first.
14071407

14081408
The order breaks down to this:
14091409

1410-
.. image:: example/fixtures/test_fixtures_order_scope.svg
1410+
.. image:: /example/fixtures/test_fixtures_order_scope.svg
14111411
:align: center
14121412

14131413
Fixtures of the same order execute based on dependencies
@@ -1421,17 +1421,17 @@ sure it is executed after ``b``.
14211421

14221422
For example:
14231423

1424-
.. literalinclude:: example/fixtures/test_fixtures_order_dependencies.py
1424+
.. literalinclude:: /example/fixtures/test_fixtures_order_dependencies.py
14251425

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

1428-
.. image:: example/fixtures/test_fixtures_order_dependencies.svg
1428+
.. image:: /example/fixtures/test_fixtures_order_dependencies.svg
14291429
:align: center
14301430

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

1434-
.. image:: example/fixtures/test_fixtures_order_dependencies_flat.svg
1434+
.. image:: /example/fixtures/test_fixtures_order_dependencies_flat.svg
14351435
:align: center
14361436

14371437
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.
14421442

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

1445-
.. image:: example/fixtures/test_fixtures_order_dependencies_unclear.svg
1445+
.. image:: /example/fixtures/test_fixtures_order_dependencies_unclear.svg
14461446
:align: center
14471447

14481448
Because nothing requested ``c`` other than ``g``, and ``g`` also requests ``f``,
@@ -1479,11 +1479,11 @@ non-autouse fixtures within that scope.
14791479

14801480
So if the test file looked like this:
14811481

1482-
.. literalinclude:: example/fixtures/test_fixtures_order_autouse.py
1482+
.. literalinclude:: /example/fixtures/test_fixtures_order_autouse.py
14831483

14841484
the graph would look like this:
14851485

1486-
.. image:: example/fixtures/test_fixtures_order_autouse.svg
1486+
.. image:: /example/fixtures/test_fixtures_order_autouse.svg
14871487
:align: center
14881488

14891489
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
14961496
execute for every test that can reach it, even if they don't request it. For
14971497
example, consider this file:
14981498

1499-
.. literalinclude:: example/fixtures/test_fixtures_order_autouse_multiple_scopes.py
1499+
.. literalinclude:: /example/fixtures/test_fixtures_order_autouse_multiple_scopes.py
15001500

15011501
Even though nothing in ``TestClassWithC1Request`` is requesting ``c1``, it still
15021502
is executed for the tests inside it anyway:
15031503

1504-
.. image:: example/fixtures/test_fixtures_order_autouse_multiple_scopes.svg
1504+
.. image:: /example/fixtures/test_fixtures_order_autouse_multiple_scopes.svg
15051505
:align: center
15061506

15071507
But just because one autouse fixture requested a non-autouse fixture, that
@@ -1512,11 +1512,11 @@ fixture) can apply to.
15121512

15131513
For example, take a look at this test file:
15141514

1515-
.. literalinclude:: example/fixtures/test_fixtures_order_autouse_temp_effects.py
1515+
.. literalinclude:: /example/fixtures/test_fixtures_order_autouse_temp_effects.py
15161516

15171517
It would break down to something like this:
15181518

1519-
.. image:: example/fixtures/test_fixtures_order_autouse_temp_effects.svg
1519+
.. image:: /example/fixtures/test_fixtures_order_autouse_temp_effects.svg
15201520
:align: center
15211521

15221522
For ``test_req`` and ``test_no_req`` inside ``TestClassWithAutouse``, ``c3``
File renamed without changes.

doc/en/plugin_list.rst doc/en/reference/plugin_list.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _plugin-list:
2+
13
Plugins List
24
============
35

0 commit comments

Comments
 (0)