Skip to content

Commit d6d3e4a

Browse files
committed
doc: fixes for regendoc
Turns out regendoc doesn't work with the new `.. tab` changes. Undo the tabification in problematic cases for now. Ideally though, we fix regendoc and revert this.
1 parent 7cb3974 commit d6d3e4a

File tree

8 files changed

+52
-169
lines changed

8 files changed

+52
-169
lines changed

doc/en/example/markers.rst

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,11 @@ Registering markers
239239
240240
Registering markers for your test suite is simple:
241241

242-
.. tab:: toml
242+
.. code-block:: toml
243243
244-
.. code-block:: toml
245-
246-
# content of pytest.toml
247-
[pytest]
248-
markers = ["webtest: mark a test as a webtest.", "slow: mark test as slow."]
249-
250-
.. tab:: ini
251-
252-
.. code-block:: ini
253-
254-
[pytest]
255-
markers =
256-
webtest: mark a test as a webtest.
257-
slow: mark test as slow.
244+
# content of pytest.toml
245+
[pytest]
246+
markers = ["webtest: mark a test as a webtest.", "slow: mark test as slow."]
258247
259248
Multiple custom markers can be registered, by defining each one in its own line, as shown in above example.
260249

doc/en/example/pythoncollection.rst

Lines changed: 24 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,11 @@ Changing directory recursion
9090

9191
You can set the :confval:`norecursedirs` option in a configuration file:
9292

93-
.. tab:: toml
93+
.. code-block:: toml
9494
95-
.. code-block:: toml
96-
97-
# content of pytest.toml
98-
[pytest]
99-
norecursedirs = [".svn", "_build", "tmp*"]
100-
101-
.. tab:: ini
102-
103-
.. code-block:: ini
104-
105-
[pytest]
106-
norecursedirs = .svn _build tmp*
95+
# content of pytest.toml
96+
[pytest]
97+
norecursedirs = [".svn", "_build", "tmp*"]
10798
10899
This would tell ``pytest`` to not recurse into typical subversion or sphinx-build directories or into any ``tmp`` prefixed directory.
109100

@@ -117,26 +108,14 @@ the :confval:`python_files`, :confval:`python_classes` and
117108
:confval:`python_functions` in your :ref:`configuration file <config file formats>`.
118109
Here is an example:
119110

120-
.. tab:: toml
121-
122-
.. code-block:: toml
111+
.. code-block:: toml
123112
124-
# content of pytest.toml
125-
# Example 1: have pytest look for "check" instead of "test"
126-
[pytest]
127-
python_files = ["check_*.py"]
128-
python_classes = ["Check"]
129-
python_functions = ["*_check"]
130-
131-
.. tab:: ini
132-
133-
.. code-block:: ini
134-
135-
# Example 1: have pytest look for "check" instead of "test"
136-
[pytest]
137-
python_files = check_*.py
138-
python_classes = Check
139-
python_functions = *_check
113+
# content of pytest.toml
114+
# Example 1: have pytest look for "check" instead of "test"
115+
[pytest]
116+
python_files = ["check_*.py"]
117+
python_classes = ["Check"]
118+
python_functions = ["*_check"]
140119
141120
This would make ``pytest`` look for tests in files that match the ``check_*
142121
.py`` glob-pattern, ``Check`` prefixes in classes, and functions and methods
@@ -173,22 +152,12 @@ The test collection would look like this:
173152
174153
You can check for multiple glob patterns by adding a space between the patterns:
175154

176-
.. tab:: toml
177-
178-
.. code-block:: toml
179-
180-
# content of pytest.toml
181-
# Example 2: have pytest look for files with "test" and "example"
182-
[pytest]
183-
python_files = ["test_*.py", "example_*.py"]
155+
.. code-block:: toml
184156
185-
.. tab:: ini
186-
187-
.. code-block:: ini
188-
189-
# Example 2: have pytest look for files with "test" and "example"
190-
[pytest]
191-
python_files = test_*.py example_*.py
157+
# content of pytest.toml
158+
# Example 2: have pytest look for files with "test" and "example"
159+
[pytest]
160+
python_files = ["test_*.py", "example_*.py"]
192161
193162
.. note::
194163

@@ -212,20 +181,11 @@ which would run the respective test module. Like with
212181
other options, through a configuration file and the :confval:`addopts` option you
213182
can make this change more permanently:
214183

215-
.. tab:: toml
216-
217-
.. code-block:: toml
218-
219-
# content of pytest.toml
220-
[pytest]
221-
addopts = ["--pyargs"]
222-
223-
.. tab:: ini
184+
.. code-block:: toml
224185
225-
.. code-block:: ini
226-
227-
[pytest]
228-
addopts = --pyargs
186+
# content of pytest.toml
187+
[pytest]
188+
addopts = ["--pyargs"]
229189
230190
Now a simple invocation of ``pytest NAME`` will check
231191
if NAME exists as an importable package/module and otherwise
@@ -264,20 +224,11 @@ Customizing test collection
264224
265225
You can easily instruct ``pytest`` to discover tests from every Python file:
266226

267-
.. tab:: toml
268-
269-
.. code-block:: toml
270-
271-
# content of pytest.toml
272-
[pytest]
273-
python_files = ["*.py"]
274-
275-
.. tab:: ini
276-
277-
.. code-block:: ini
227+
.. code-block:: toml
278228
279-
[pytest]
280-
python_files = *.py
229+
# content of pytest.toml
230+
[pytest]
231+
python_files = ["*.py"]
281232
282233
However, many projects will have a ``setup.py`` which they don't want to be
283234
imported. Moreover, there may files only importable by a specific python

doc/en/example/simple.rst

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,11 @@ every time you use ``pytest``. For example, if you always want to see
1111
detailed info on skipped and xfailed tests, as well as have terser "dot"
1212
progress output, you can write it into a configuration file:
1313

14-
.. tab:: toml
15-
16-
.. code-block:: toml
17-
18-
# content of pytest.toml
19-
[pytest]
20-
addopts = ["-ra", "-q"]
21-
22-
.. tab:: ini
23-
24-
.. code-block:: ini
25-
26-
[pytest]
27-
addopts = -ra -q
14+
.. code-block:: toml
2815
16+
# content of pytest.toml
17+
[pytest]
18+
addopts = ["-ra", "-q"]
2919
3020
Alternatively, you can set a ``PYTEST_ADDOPTS`` environment variable to add command
3121
line options while the environment is in use:

doc/en/explanation/goodpractices.rst

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,11 @@ For new projects, we recommend to use ``importlib`` :ref:`import mode <import-mo
9696
(see which-import-mode_ for a detailed explanation).
9797
To this end, add the following to your configuration file:
9898

99-
.. tab:: toml
100-
101-
.. code-block:: toml
102-
103-
# content of pytest.toml
104-
[pytest]
105-
addopts = ["--import-mode=importlib"]
106-
107-
.. tab:: ini
108-
109-
.. code-block:: ini
99+
.. code-block:: toml
110100
111-
[pytest]
112-
addopts = --import-mode=importlib
101+
# content of pytest.toml
102+
[pytest]
103+
addopts = ["--import-mode=importlib"]
113104
114105
.. _src-layout:
115106

doc/en/how-to/doctest.rst

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,11 @@ and functions, including from test modules:
7070
You can make these changes permanent in your project by
7171
putting them into a configuration file like this:
7272

73-
.. tab:: toml
74-
75-
.. code-block:: toml
76-
77-
# content of pytest.toml
78-
[pytest]
79-
addopts = ["--doctest-modules"]
80-
81-
.. tab:: ini
82-
83-
.. code-block:: ini
84-
85-
[pytest]
86-
addopts = --doctest-modules
73+
.. code-block:: toml
8774
75+
# content of pytest.toml
76+
[pytest]
77+
addopts = ["--doctest-modules"]
8878
8979
Encoding
9080
--------

doc/en/how-to/fixtures.rst

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,21 +1738,11 @@ and you may specify fixture usage at the test module level using :globalvar:`pyt
17381738
It is also possible to put fixtures required by all tests in your project
17391739
into a configuration file:
17401740

1741-
.. tab:: toml
1742-
1743-
.. code-block:: toml
1744-
1745-
# content of pytest.toml
1746-
[pytest]
1747-
usefixtures = ["cleandir"]
1748-
1749-
.. tab:: ini
1750-
1751-
.. code-block:: ini
1752-
1753-
[pytest]
1754-
usefixtures = cleandir
1741+
.. code-block:: toml
17551742
1743+
# content of pytest.toml
1744+
[pytest]
1745+
usefixtures = ["cleandir"]
17561746
17571747
.. warning::
17581748

doc/en/how-to/writing_plugins.rst

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -422,20 +422,11 @@ which is especially useful for longer tests and/or longer ``conftest.py`` files.
422422
Note that for ``pytester.copy_example`` to work we need to set `pytester_example_dir`
423423
in our configuration file to tell pytest where to look for example files.
424424

425-
.. tab:: toml
425+
.. code-block:: toml
426426
427-
.. code-block:: toml
428-
429-
# content of pytest.toml
430-
[pytest]
431-
pytester_example_dir = "."
432-
433-
.. tab:: ini
434-
435-
.. code-block:: ini
436-
437-
[pytest]
438-
pytester_example_dir = .
427+
# content of pytest.toml
428+
[pytest]
429+
pytester_example_dir = "."
439430
440431
441432
.. code-block:: python

doc/en/reference/reference.rst

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,20 +1333,11 @@ passed multiple times. The expected format is ``name=value``. For example::
13331333
Add the specified ``OPTS`` to the set of command line arguments as if they
13341334
had been specified by the user. Example: if you have this configuration file content:
13351335

1336-
.. tab:: toml
1337-
1338-
.. code-block:: toml
1339-
1340-
# content of pytest.toml
1341-
[pytest]
1342-
addopts = ["--maxfail=2", "-rf"] # exit after 2 failures, report fail info
1336+
.. code-block:: toml
13431337
1344-
.. tab:: ini
1345-
1346-
.. code-block:: ini
1347-
1348-
[pytest]
1349-
addopts = --maxfail=2 -rf # exit after 2 failures, report fail info
1338+
# content of pytest.toml
1339+
[pytest]
1340+
addopts = ["--maxfail=2", "-rf"] # exit after 2 failures, report fail info
13501341
13511342
issuing ``pytest test_hello.py`` actually means:
13521343

0 commit comments

Comments
 (0)