@@ -5,6 +5,7 @@ Welcome to pytest-random-order
5
5
pytest-random-order is a plugin for `pytest <http://pytest.org >`_ that randomises the order in which
6
6
tests are run to reveal unwanted coupling between tests. The plugin allows user to control the level
7
7
of randomness they want to introduce and to disable reordering on subsets of tests.
8
+ Tests can be rerun in a specific order by passing a seed value reported in a previous test run.
8
9
9
10
.. toctree ::
10
11
:maxdepth: 2
@@ -37,6 +38,13 @@ To disable reordering of tests in a module or class, use pytest marker notation:
37
38
38
39
pytestmark = pytest.mark.random_order(disabled=True)
39
40
41
+ To rerun tests in a particular order:
42
+
43
+ ::
44
+
45
+ $ pytest -v --random-order-seed=<value-reported-in-previous-run>
46
+
47
+
40
48
Design
41
49
------
42
50
@@ -118,6 +126,28 @@ No matter what will be the bucket type for the test run, ``test_number_one`` wil
118
126
before ``test_number_two ``.
119
127
120
128
129
+ Rerun Tests in the Same Order (Same Seed)
130
+ +++++++++++++++++++++++++++++++++++++++++
131
+
132
+ If you discover a failing test because you reordered tests, you will probably want to be able to rerun the tests
133
+ in the same failing order. To allow reproducing test order, the plugin reports the seed value it used with pseudo random number
134
+ generator:
135
+
136
+ ::
137
+
138
+ ============================= test session starts ==============================
139
+ ..
140
+ Using --random-order-bucket=module
141
+ Using --random-order-seed=24775
142
+ ...
143
+
144
+ You can now the ``--random-order-seed=... `` bit as an argument to the next run to produce the same order:
145
+
146
+ ::
147
+
148
+ $ pytest -v --random-order-seed=24775
149
+
150
+
121
151
Disable the Plugin
122
152
++++++++++++++++++
123
153
0 commit comments