@@ -88,13 +88,21 @@ Example:
8888 Changing directory recursion
8989-----------------------------------------------------
9090
91- You can set the :confval: `norecursedirs ` option in an ini-file, for example your `` pytest.ini `` in the project root directory :
91+ You can set the :confval: `norecursedirs ` option in a configuration file :
9292
93- .. code-block :: ini
93+ .. tab :: toml
9494
95- # content of pytest.ini
96- [pytest]
97- norecursedirs = .svn _build tmp*
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*
98106
99107 This would tell ``pytest `` to not recurse into typical subversion or sphinx-build directories or into any ``tmp `` prefixed directory.
100108
@@ -108,14 +116,25 @@ the :confval:`python_files`, :confval:`python_classes` and
108116:confval: `python_functions ` in your :ref: `configuration file <config file formats >`.
109117Here is an example:
110118
111- .. code-block :: ini
119+ .. tab :: toml
120+
121+ .. code-block :: toml
112122
113- # content of pytest.ini
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
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
119138
120139 This would make ``pytest `` look for tests in files that match the ``check_*
121140.py `` glob-pattern, ``Check `` prefixes in classes, and functions and methods
@@ -152,12 +171,21 @@ The test collection would look like this:
152171
153172 You can check for multiple glob patterns by adding a space between the patterns:
154173
155- .. code-block :: ini
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"]
156181
157- # Example 2: have pytest look for files with "test" and "example"
158- # content of pytest.ini
159- [pytest]
160- python_files = test_*.py example_*.py
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
161189
162190 .. note ::
163191
@@ -178,14 +206,22 @@ example if you have unittest2 installed you can type:
178206 pytest --pyargs unittest2.test.test_skipping -q
179207
180208 which would run the respective test module. Like with
181- other options, through an ini- file and the :confval: `addopts ` option you
209+ other options, through a configuration file and the :confval: `addopts ` option you
182210can make this change more permanently:
183211
184- .. code-block :: ini
212+ .. tab :: toml
213+
214+ .. code-block :: toml
215+
216+ [pytest]
217+ addopts = ["--pyargs"]
218+
219+ .. tab :: ini
185220
186- # content of pytest.ini
187- [pytest]
188- addopts = --pyargs
221+ .. code-block :: ini
222+
223+ [pytest]
224+ addopts = --pyargs
189225
190226 Now a simple invocation of ``pytest NAME `` will check
191227if NAME exists as an importable package/module and otherwise
@@ -224,11 +260,19 @@ Customizing test collection
224260
225261 You can easily instruct ``pytest `` to discover tests from every Python file:
226262
227- .. code-block :: ini
263+ .. tab :: toml
264+
265+ .. code-block :: toml
266+
267+ [pytest]
268+ python_files = ["*.py"]
269+
270+ .. tab :: ini
271+
272+ .. code-block :: ini
228273
229- # content of pytest.ini
230- [pytest]
231- python_files = *.py
274+ [pytest]
275+ python_files = *.py
232276
233277 However, many projects will have a ``setup.py `` which they don't want to be
234278imported. Moreover, there may files only importable by a specific python
0 commit comments