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
@@ -391,8 +376,7 @@ Applying a mark to a fixture function never had any effect, but it is a common u
391
376
392
377
@pytest.mark.usefixtures("clean_database")
393
378
@pytest.fixture
394
-
defuser() -> User:
395
-
...
379
+
defuser() -> User: ...
396
380
397
381
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.
398
382
@@ -907,8 +891,7 @@ Applying marks to values of a ``pytest.mark.parametrize`` call is now deprecated
907
891
(50, 500),
908
892
],
909
893
)
910
-
deftest_foo(a, b):
911
-
...
894
+
deftest_foo(a, b): ...
912
895
913
896
This code applies the ``pytest.mark.xfail(reason="flaky")`` mark to the ``(6, 36)`` value of the above parametrization
914
897
call.
@@ -931,8 +914,7 @@ To update the code, use ``pytest.param``:
931
914
(50, 500),
932
915
],
933
916
)
934
-
deftest_foo(a, b):
935
-
...
917
+
deftest_foo(a, b): ...
936
918
937
919
938
920
.. _pytest_funcarg__ prefix deprecated:
@@ -1083,15 +1065,13 @@ This is just a matter of renaming the fixture as the API is the same:
1083
1065
1084
1066
.. code-block:: python
1085
1067
1086
-
deftest_foo(record_xml_property):
1087
-
...
1068
+
deftest_foo(record_xml_property): ...
1088
1069
1089
1070
Change to:
1090
1071
1091
1072
.. code-block:: python
1092
1073
1093
-
deftest_foo(record_property):
1094
-
...
1074
+
deftest_foo(record_property): ...
1095
1075
1096
1076
1097
1077
.. _passing command-line string to pytest.main deprecated:
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