Skip to content

Commit 5ef4a11

Browse files
committed
More documentation updates
- add note aborted supported OSes - add note about global scope - reference pytest-dependency plugin - some reordering in README
1 parent 8353e09 commit 5ef4a11

File tree

2 files changed

+46
-26
lines changed

2 files changed

+46
-26
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
pytest-order [![PyPI version](https://badge.fury.io/py/pytest-order.svg)](https://badge.fury.io/py/pytest-order) [![Build Status](https://travis-ci.org/mrbean-bremen/pytest-order.svg?branch=master)](https://travis-ci.org/mrbean-bremen/pytest-order) [![Python version](https://img.shields.io/pypi/pyversions/pytest-order.svg)](https://img.shields.io/pypi/pyversions/pytest-order.svg)
22
============
3+
`pytest-order` is a pytest plugin that allows you to customize the order in which
4+
your tests are run. It uses the marker `order` that defines when a specific
5+
test shall be run relative to the other tests.
6+
37
This is a fork of [pytest-ordering](https://github.com/ftobia/pytest-ordering).
48
That project is not maintained anymore, and there are several helpful PRs
5-
waiting for merge. Therefore I decided to create this fork that tries to
6-
combine the original code with most of the provided PRs.
7-
My hope is that the original project will be moved to the pytest
8-
organization as outlined in
9-
[this issue](https://github.com/ftobia/pytest-ordering/issues/32). When this
10-
happens, this fork will be obsolete.
11-
12-
_Note:_ ``pytest-order`` is not compatible with ``pytest-ordering`` due to the
13-
changed marker name (``order`` instead of ``run``). Only the ``order``
9+
that are now integrated into `pytest-order`. The idea and most of the code
10+
has been created by Frank Tobia, the author of that plugin. In case
11+
`pytest-ordering` is revived, this project will be obsolete.
12+
13+
_Note:_ `pytest-order` is not compatible with `pytest-ordering` due to the
14+
changed marker name (`order` instead of `run`). Only the `order`
1415
marker is supported, support for all additional markers has been removed for
1516
consistence (see [this issue](https://github.com/ftobia/pytest-ordering/issues/38)).
1617

17-
18-
pytest-order is a pytest plugin to run your tests in a specific order.
18+
_From the original project:_
1919

2020
Have you ever wanted to easily run one of your tests before any others run?
2121
Or run some tests last? Or run this one test before that other test? Or
@@ -56,6 +56,6 @@ yields the output:
5656
=========================== 2 passed in 0.01 seconds ===========================
5757

5858
More information can be found in the documentation:
59-
- for the [latest release](https://mrbean-bremen.github.io/pytest-order/stable/)
60-
- for the [current master](https://mrbean-bremen.github.io/pytest-order/dev/)
61-
59+
- for the [latest release](https://mrbean-bremen.github.io/pytest-order/stable/)
60+
- for the [current master](https://mrbean-bremen.github.io/pytest-order/dev/)
61+

docs/source/index.rst

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Introduction
22
============
33
``pytest-order`` is a pytest plugin which allows you to customize the order
4-
in which run your tests are run. It provides the marker ``order``, that has
4+
in which your tests are run. It provides the marker ``order``, that has
55
attributes that defines when your tests should run in relation to each other.
66
These attributes can be absolute (i.e. first, or second-to-last) or relative
77
(i.e. run this test before this other test).
@@ -28,10 +28,14 @@ Here are examples for which markers correspond to markers in
2828

2929
Supported Python and pytest versions
3030
------------------------------------
31-
pytest-order supports python 2.7, 3.5 - 3.9, and pypy/pypy3, and is
31+
``pytest-order`` supports python 2.7, 3.5 - 3.9, and pypy/pypy3, and is
3232
compatible with pytest 3.6.0 or newer. Note that support for Python 2 will
3333
be removed in one of the next versions.
3434

35+
All supported combinations of Python and pytest versions are tested in
36+
the CI builds. While these tests run under Linux, the plugin shall work
37+
under MacOs and Windows as well.
38+
3539
Installation
3640
------------
3741
The latest released version can be installed from
@@ -60,7 +64,7 @@ For example, for the following tests:
6064
def test_bar():
6165
assert True
6266
63-
Here is the output:
67+
the output is something like:
6468

6569
::
6670

@@ -74,7 +78,7 @@ Here is the output:
7478

7579
=========================== 2 passed in 0.01 seconds ===========================
7680

77-
With pytest-order, you can change the default ordering as follows:
81+
With ``pytest-order``, you can change the default ordering as follows:
7882

7983
.. code:: python
8084
@@ -88,6 +92,8 @@ With pytest-order, you can change the default ordering as follows:
8892
def test_bar():
8993
assert True
9094
95+
This will generate the output:
96+
9197
::
9298

9399
$ py.test test_foo.py -vv
@@ -104,6 +110,13 @@ With pytest-order, you can change the default ordering as follows:
104110
Usage
105111
=====
106112
The above is a trivial example, but ordering is respected across test files.
113+
114+
.. note ::
115+
The scope of the ordering is always global, e.g. tests with lower ordinal
116+
numbers are always executed before tests with higher numbers, regardless of
117+
the module and class they reside in. This may be changed to be
118+
configurable in a later version.
119+
107120
There are currently three possibilities to define the order:
108121

109122
Order by number
@@ -152,9 +165,9 @@ There is no limit for the numbers that can be used in this way.
152165
Order using ordinals
153166
--------------------
154167

155-
You can also use markers such as "first", "second", "last", and
156-
"second_to_last". These are convenience notations, and have the same effect
157-
as the numbers 0, 1, -1 and -2 that have been shown above:
168+
Instead of the numbers, you can use ordinal names such as "first", "second",
169+
"last", and "second_to_last". These are convenience notations, and have the
170+
same effect as the numbers 0, 1, -1 and -2 that have been shown above:
158171

159172
.. code:: python
160173
@@ -191,8 +204,8 @@ as the numbers 0, 1, -1 and -2 that have been shown above:
191204

192205
=========================== 4 passed in 0.02 seconds ===========================
193206

194-
Convenience names are only defined for the first and the last 8 numbers,
195-
here is the complete list with the corresponding numbers:
207+
Convenience names are only defined for the first and the last 8 numbers.
208+
Here is the complete list with the corresponding numbers:
196209

197210
- 'first': 0
198211
- 'second': 1
@@ -245,6 +258,12 @@ by their name:
245258

246259
=========================== 4 passed in 0.02 seconds ===========================
247260

261+
.. note::
262+
The `pytest-dependency <https://pypi.org/project/pytest-dependency/>`__
263+
plugin also manages dependencies between tests (skips tests that depend
264+
on skipped or failed tests), but doesn't do any ordering. You can combine
265+
both plugins if you need both options.
266+
248267
Configuration
249268
=============
250269
Currently there is only one option that changes the behavior of the plugin.
@@ -255,18 +274,19 @@ You may sometimes find that you want to suggest an ordering of tests, while
255274
allowing it to be overridden for good reason. For example, if you run your test
256275
suite in parallel and have a number of tests which are particularly slow, it
257276
might be desirable to start those tests running first, in order to optimize
258-
your completion time. You can use the pytest-order plugin to inform pytest
277+
your completion time. You can use the ``pytest-order`` plugin to inform pytest
259278
of this.
279+
260280
Now suppose you also want to prioritize tests which failed during the
261281
previous run, by using the ``--failed-first`` option. By default,
262282
pytest-order will override the ``--failed-first`` order, but by adding the
263283
``--indulgent-ordering`` option, you can ask pytest to run the sort from
264284
pytest-order *before* the sort from ``--failed-first``, allowing the failed
265-
tests to be sorted to the front.
285+
tests to be sorted to the front (note that in pytest versions from 6.0 on,
286+
this seems not to be needed anymore, at least in this specific case).
266287

267288

268289
.. toctree::
269290
:maxdepth: 2
270291

271292
.. _markers: https://pytest.org/latest/mark.html
272-

0 commit comments

Comments
 (0)