You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/en/deprecations.rst
+21-42
Original file line number
Diff line number
Diff line change
@@ -33,13 +33,11 @@ have been available since years and should be used instead.
33
33
.. code-block:: python
34
34
35
35
@pytest.mark.tryfirst
36
-
defpytest_runtest_call():
37
-
...
36
+
defpytest_runtest_call(): ...
38
37
39
38
40
39
# or
41
-
defpytest_runtest_call():
42
-
...
40
+
defpytest_runtest_call(): ...
43
41
44
42
45
43
pytest_runtest_call.tryfirst =True
@@ -49,8 +47,7 @@ should be changed to:
49
47
.. code-block:: python
50
48
51
49
@pytest.hookimpl(tryfirst=True)
52
-
defpytest_runtest_call():
53
-
...
50
+
defpytest_runtest_call(): ...
54
51
55
52
Changed ``hookimpl`` attributes:
56
53
@@ -146,8 +143,7 @@ Applying a mark to a fixture function never had any effect, but it is a common u
146
143
147
144
@pytest.mark.usefixtures("clean_database")
148
145
@pytest.fixture
149
-
defuser() -> User:
150
-
...
146
+
defuser() -> User: ...
151
147
152
148
Users expected in this case that the ``usefixtures`` mark would have its intended effect of using the ``clean_database`` fixture when ``user`` was invoked, when in fact it has no effect at all.
153
149
@@ -308,11 +304,9 @@ they are in fact part of the ``nose`` support.
308
304
defteardown(self):
309
305
self.resource.close()
310
306
311
-
deftest_foo(self):
312
-
...
307
+
deftest_foo(self): ...
313
308
314
-
deftest_bar(self):
315
-
...
309
+
deftest_bar(self): ...
316
310
317
311
318
312
@@ -327,11 +321,9 @@ Native pytest support uses ``setup_method`` and ``teardown_method`` (see :ref:`x
327
321
defteardown_method(self):
328
322
self.resource.close()
329
323
330
-
deftest_foo(self):
331
-
...
324
+
deftest_foo(self): ...
332
325
333
-
deftest_bar(self):
334
-
...
326
+
deftest_bar(self): ...
335
327
336
328
337
329
This is easy to do in an entire code base by doing a simple find/replace.
@@ -346,17 +338,14 @@ Code using `@with_setup <with-setup-nose>`_ such as this:
Copy file name to clipboardExpand all lines: doc/en/reference/reference.rst
+3-6
Original file line number
Diff line number
Diff line change
@@ -164,8 +164,7 @@ Add warning filters to marked test items.
164
164
.. code-block:: python
165
165
166
166
@pytest.mark.filterwarnings("ignore:.*usage will be deprecated.*:DeprecationWarning")
167
-
deftest_foo():
168
-
...
167
+
deftest_foo(): ...
169
168
170
169
171
170
.. _`pytest.mark.parametrize ref`:
@@ -276,8 +275,7 @@ For example:
276
275
.. code-block:: python
277
276
278
277
@pytest.mark.timeout(10, "slow", method="thread")
279
-
deftest_function():
280
-
...
278
+
deftest_function(): ...
281
279
282
280
Will create and attach a :class:`Mark <pytest.Mark>` object to the collected
283
281
:class:`Item <pytest.Item>`, which can then be accessed by fixtures or hooks with
@@ -294,8 +292,7 @@ Example for using multiple custom markers:
294
292
295
293
@pytest.mark.timeout(10, "slow", method="thread")
296
294
@pytest.mark.slow
297
-
deftest_function():
298
-
...
295
+
deftest_function(): ...
299
296
300
297
When :meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>` or :meth:`Node.iter_markers_with_node <_pytest.nodes.Node.iter_markers_with_node>` is used with multiple markers, the marker closest to the function will be iterated over first. The above example will result in ``@pytest.mark.slow`` followed by ``@pytest.mark.timeout(...)``.
0 commit comments