Skip to content

Commit e6aaf0d

Browse files
committed
Minor documentation changes
- added feature section in README, fixed badge links - minor changes in gh-pages documentation
1 parent fbedef9 commit e6aaf0d

File tree

2 files changed

+59
-46
lines changed

2 files changed

+59
-46
lines changed

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
_pytest-order_ - a pytest plugin to order test execution
22
========================================================
33

4-
[![PyPI version](https://badge.fury.io/py/pytest-order.svg)](https://pypi.org/project/pytest-order) ![Testsuite](https://github.com/mrbean-bremen/pytest-order/workflows/Testsuite/badge.svg) ![DocBuild](https://github.com/mrbean-bremen/pytest-order/workflows/DocBuild/badge.svg) [![codecov](https://codecov.io/gh/mrbean-bremen/pytest-order/branch/master/graph/badge.svg?token=M9PHWZSHUU)](https://codecov.io/gh/mrbean-bremen/pytest-order) [![Python version](https://img.shields.io/pypi/pyversions/pytest-order.svg)](https://pypi.org/project/pytest-order)
4+
[![PyPI version](https://badge.fury.io/py/pytest-order.svg)](https://pypi.org/project/pytest-order) [![Testsuite](https://github.com/mrbean-bremen/pytest-order/workflows/Testsuite/badge.svg)](https://github.com/mrbean-bremen/pytest-order/actions?query=workflow%3ATestsuite) [![DocBuild](https://github.com/mrbean-bremen/pytest-order/workflows/DocBuild/badge.svg)](https://github.com/mrbean-bremen/pytest-order/actions?query=workflow%3ADocBuild) [![codecov](https://codecov.io/gh/mrbean-bremen/pytest-order/branch/master/graph/badge.svg?token=M9PHWZSHUU)](https://codecov.io/gh/mrbean-bremen/pytest-order) [![Python version](https://img.shields.io/pypi/pyversions/pytest-order.svg)](https://pypi.org/project/pytest-order)
55

66
`pytest-order` is a pytest plugin that allows you to customize the order in which
77
your tests are run. It uses the marker `order` that defines when a specific
88
test shall be run relative to the other tests.
99

1010
`pytest-order` is a fork of
1111
[pytest-ordering](https://github.com/ftobia/pytest-ordering) that provides
12-
some additional features--see [below](#comparison-with-pytest_ordering) for
12+
some additional features - see [below](#comparison-with-pytest_ordering) for
1313
details.
1414

1515
`pytest-order` works with Python 2.7 and 3.5 - 3.9, with pytest
@@ -67,6 +67,24 @@ yields the output:
6767

6868
=========================== 2 passed in 0.01 seconds ===========================
6969

70+
Features
71+
--------
72+
`pytest-order` provides the following features:
73+
- ordering of tests by index, as show above
74+
- ordering of tests both from the start and from the end (via negative
75+
index)
76+
- ordering of tests relative to each other (via the `before` and `after`
77+
marker attributes)
78+
- session-, module- and class-scope ordering via the ``order-scope`` option
79+
- ordering tests with `pytest-dependency` markers if using the
80+
``order-dependencies`` option
81+
- sparse ordering of tests via the ``sparse-ordering`` option
82+
- invocation of the plugin before other plugins if the
83+
``indulgent-ordering`` option is used
84+
85+
A usage guide for each feature can be
86+
found in the [documentation](https://mrbean-bremen.github.io/pytest-order/dev/).
87+
7088
History
7189
-------
7290
This is a fork of [pytest-ordering](https://github.com/ftobia/pytest-ordering).
@@ -83,14 +101,8 @@ with `pytest-ordering` due to the changed marker name (`order` instead of
83101
rationale see also
84102
[this issue](https://github.com/ftobia/pytest-ordering/issues/38)).
85103

86-
Apart from the changed marker name, there is a number of features not
87-
implemented in the released version of `pytest-ordering`:
88-
- support for ordering tests relative to each other
89-
- support for module and class-scope ordering via a config option
90-
- optional support for ordering tests with `pytest-dependency` markers
91-
- optional support for sparse ordering
92-
- optional invocation of the plugin before (instead of after) other plugins
93-
94-
Most of these features are derived from [issues](https://github.com/mrbean-bremen/pytest-order/blob/master/old_issues.md)
95-
and pull requests in `pytest-ordering`. A description of each feature can be
96-
found in the [documentation](https://mrbean-bremen.github.io/pytest-order/dev/).
104+
Ordering relative to other tests and all of the configuration options are not
105+
available in the released version of `pytest-ordering`.
106+
However, most of these features are derived from
107+
[issues](https://github.com/mrbean-bremen/pytest-order/blob/master/old_issues.md)
108+
and pull requests already existing in `pytest-ordering`.

docs/source/index.rst

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ The above is a trivial example, but ordering is respected across test files.
122122

123123
.. note::
124124
The scope of the ordering is global per default, e.g. tests with lower
125-
ordinal numbers are always executed before tests with higher numbers,
126-
regardless of the module and class they reside in. This can be changed
127-
by using the :ref:`order-scope` option.
125+
ordinal numbers are always executed before tests with higher numbers in
126+
the same test session, regardless of the module and class they reside in.
127+
This can be changed by using the :ref:`order-scope` option.
128128

129129
Ordering is done either absolutely, by using ordinal numbers that define the
130130
order, or relative to other tests, using the ``before`` and ``after``
@@ -186,25 +186,26 @@ Order using ordinals
186186

187187
Instead of the numbers, you can use ordinal names such as "first", "second",
188188
"last", and "second_to_last". These are convenience notations, and have the
189-
same effect as the numbers 0, 1, -1 and -2 that have been shown above:
189+
same effect as the numbers 0, 1, -1 and -2, respectively, that have been shown
190+
above:
190191

191192
.. code:: python
192193
193194
import pytest
194195
195-
@pytest.mark.order('second_to_last')
196+
@pytest.mark.order("second_to_last")
196197
def test_three():
197198
assert True
198199
199-
@pytest.mark.order('last')
200+
@pytest.mark.order("last")
200201
def test_four():
201202
assert True
202203
203-
@pytest.mark.order('second')
204+
@pytest.mark.order("second")
204205
def test_two():
205206
assert True
206207
207-
@pytest.mark.order('first')
208+
@pytest.mark.order("first")
208209
def test_one():
209210
assert True
210211
@@ -226,29 +227,29 @@ same effect as the numbers 0, 1, -1 and -2 that have been shown above:
226227
Convenience names are only defined for the first and the last 8 numbers.
227228
Here is the complete list with the corresponding numbers:
228229

229-
- 'first': 0
230-
- 'second': 1
231-
- 'third': 2
232-
- 'fourth': 3
233-
- 'fifth': 4
234-
- 'sixth': 5
235-
- 'seventh': 6
236-
- 'eighth': 7
237-
- 'last': -1
238-
- 'second_to_last': -2
239-
- 'third_to_last': -3
240-
- 'fourth_to_last': -4
241-
- 'fifth_to_last': -5
242-
- 'sixth_to_last': -6
243-
- 'seventh_to_last': -7
244-
- 'eighth_to_last': -8
230+
- "first": 0
231+
- "second": 1
232+
- "third": 2
233+
- "fourth": 3
234+
- "fifth": 4
235+
- "sixth": 5
236+
- "seventh": 6
237+
- "eighth": 7
238+
- "last": -1
239+
- "second_to_last": -2
240+
- "third_to_last": -3
241+
- "fourth_to_last": -4
242+
- "fifth_to_last": -5
243+
- "sixth_to_last": -6
244+
- "seventh_to_last": -7
245+
- "eighth_to_last": -8
245246

246247
Handling of unordered tests
247248
~~~~~~~~~~~~~~~~~~~~~~~~~~~
248249
By default, tests with no ``order`` mark are executed after all tests with
249250
positive ordinal numbers (or the respective names), and before tests with
250251
negative ordinal numbers. The order of these tests in relationship to each
251-
other is not changed. This behavior may slightly change if the option
252+
other is not changed. This behavior will slightly change if the option
252253
:ref:`sparse-ordering` is used and the ordinals are not contiguous.
253254

254255

@@ -262,14 +263,14 @@ by their name:
262263
263264
import pytest
264265
265-
@pytest.mark.order(after='test_second')
266+
@pytest.mark.order(after="test_second")
266267
def test_third():
267268
assert True
268269
269270
def test_second():
270271
assert True
271272
272-
@pytest.mark.order(before='test_second')
273+
@pytest.mark.order(before="test_second")
273274
def test_first():
274275
assert True
275276
@@ -299,7 +300,7 @@ with a ``::`` suffix has to be prepended to the test name:
299300
import pytest
300301
301302
class TestA:
302-
@pytest.mark.order(after='TestB::test_c')
303+
@pytest.mark.order(after="TestB::test_c")
303304
def test_a():
304305
assert True
305306
@@ -337,11 +338,11 @@ modules, this could be expressed like:
337338
338339
import pytest
339340
340-
@pytest.mark.order(after='test_module_a.TestA::test_a')
341+
@pytest.mark.order(after="test_module_a.TestA::test_a")
341342
def test_a():
342343
assert True
343344
344-
@pytest.mark.order(before='test_module_c.test_submodule.test_2')
345+
@pytest.mark.order(before="test_module_c.test_submodule.test_2")
345346
def test_b():
346347
assert True
347348
@@ -358,7 +359,7 @@ ones. This means that relative ordering always takes preference:
358359
359360
import pytest
360361
361-
@pytest.mark.order(index=0, after='test_second')
362+
@pytest.mark.order(index=0, after="test_second")
362363
def test_first():
363364
assert True
364365
@@ -587,7 +588,7 @@ dependency, and is ignored if this is the case. Consider the following:
587588
def test_a():
588589
assert True
589590
590-
@pytest.mark.dependency(depends=['test_a'])
591+
@pytest.mark.dependency(depends=["test_a"])
591592
@pytest.mark.order("first")
592593
def test_b():
593594
assert True
@@ -600,7 +601,7 @@ following tests:
600601
601602
import pytest
602603
603-
@pytest.mark.dependency(depends=['test_b'])
604+
@pytest.mark.dependency(depends=["test_b"])
604605
def test_a():
605606
assert True
606607

0 commit comments

Comments
 (0)