Skip to content

Commit d1cb9de

Browse files
shubhamadepShubham-adepThe-Compiler
authored
Custom multiple marker execution order (#8065)
* Custom multiple marker execution order #8020 issue stated that ordering of multiple custom markers is from inside - out. I have added example for the same in the documentation. Please let me know for further changes / concerns. * remove trailing spaces The last commit was failing due to extra spaces * Ran tox tests locally to debug white space trimming issues * Resolve: ERROR: docs: commands failed for tox -e docs * Update doc/en/reference.rst Committed PR suggestions. Co-authored-by: Florian Bruhin <[email protected]> * Added reference to Node.iter_markers_with_node in documentation * Add myself to Authors Co-authored-by: Shubham <[email protected]> Co-authored-by: Florian Bruhin <[email protected]>
1 parent 3405c7e commit d1cb9de

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ Sankt Petersbug
271271
Segev Finer
272272
Serhii Mozghovyi
273273
Seth Junot
274+
Shubham Adep
274275
Simon Gomizelj
275276
Simon Kerr
276277
Skylar Downes

doc/en/reference.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,16 @@ Will create and attach a :class:`Mark <_pytest.mark.structures.Mark>` object to
248248
mark.args == (10, "slow")
249249
mark.kwargs == {"method": "thread"}
250250
251+
Example for using multiple custom markers:
252+
253+
.. code-block:: python
254+
255+
@pytest.mark.timeout(10, "slow", method="thread")
256+
@pytest.mark.slow
257+
def test_function():
258+
...
259+
260+
When :meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>` or :meth:`Node.iter_markers <_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(...)``.
251261

252262
.. _`fixtures-api`:
253263

0 commit comments

Comments
 (0)