@@ -90,19 +90,11 @@ Changing directory recursion
9090
9191You 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- [pytest]
98- norecursedirs = [".svn", "_build", "tmp*"]
99-
100- .. tab :: ini
101-
102- .. code-block :: ini
103-
104- [pytest]
105- norecursedirs = .svn _build tmp*
95+ # content of pytest.toml
96+ [pytest]
97+ norecursedirs = [".svn", "_build", "tmp*"]
10698
10799 This would tell ``pytest `` to not recurse into typical subversion or sphinx-build directories or into any ``tmp `` prefixed directory.
108100
@@ -116,25 +108,14 @@ the :confval:`python_files`, :confval:`python_classes` and
116108:confval: `python_functions ` in your :ref: `configuration file <config file formats >`.
117109Here is an example:
118110
119- .. tab :: toml
120-
121- .. code-block :: toml
111+ .. code-block :: toml
122112
123- # Example 1: have pytest look for "check" instead of "test"
124- [pytest]
125- python_files = ["check_*.py"]
126- python_classes = ["Check"]
127- python_functions = ["*_check"]
128-
129- .. tab :: ini
130-
131- .. code-block :: ini
132-
133- # Example 1: have pytest look for "check" instead of "test"
134- [pytest]
135- python_files = check_*.py
136- python_classes = Check
137- 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"]
138119
139120 This would make ``pytest `` look for tests in files that match the ``check_*
140121.py `` glob-pattern, ``Check `` prefixes in classes, and functions and methods
@@ -171,21 +152,12 @@ The test collection would look like this:
171152
172153 You can check for multiple glob patterns by adding a space between the patterns:
173154
174- .. tab :: toml
175-
176- .. code-block :: toml
177-
178- # Example 2: have pytest look for files with "test" and "example"
179- [pytest]
180- python_files = ["test_*.py", "example_*.py"]
155+ .. code-block :: toml
181156
182- .. tab :: ini
183-
184- .. code-block :: ini
185-
186- # Example 2: have pytest look for files with "test" and "example"
187- [pytest]
188- 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"]
189161
190162 .. note ::
191163
@@ -209,19 +181,11 @@ which would run the respective test module. Like with
209181other options, through a configuration file and the :confval: `addopts ` option you
210182can make this change more permanently:
211183
212- .. tab :: toml
213-
214- .. code-block :: toml
215-
216- [pytest]
217- addopts = ["--pyargs"]
218-
219- .. tab :: ini
184+ .. code-block :: toml
220185
221- .. code-block :: ini
222-
223- [pytest]
224- addopts = --pyargs
186+ # content of pytest.toml
187+ [pytest]
188+ addopts = ["--pyargs"]
225189
226190 Now a simple invocation of ``pytest NAME `` will check
227191if NAME exists as an importable package/module and otherwise
@@ -260,19 +224,11 @@ Customizing test collection
260224
261225 You can easily instruct ``pytest `` to discover tests from every Python file:
262226
263- .. tab :: toml
264-
265- .. code-block :: toml
266-
267- [pytest]
268- python_files = ["*.py"]
269-
270- .. tab :: ini
271-
272- .. code-block :: ini
227+ .. code-block :: toml
273228
274- [pytest]
275- python_files = *.py
229+ # content of pytest.toml
230+ [pytest]
231+ python_files = ["*.py"]
276232
277233 However, many projects will have a ``setup.py `` which they don't want to be
278234imported. Moreover, there may files only importable by a specific python
0 commit comments