@@ -5,6 +5,7 @@ Welcome to pytest-random-order
55pytest-random-order is a plugin for `pytest <http://pytest.org >`_ that randomises the order in which
66tests are run to reveal unwanted coupling between tests. The plugin allows user to control the level
77of 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.
89
910.. toctree ::
1011 :maxdepth: 2
@@ -37,6 +38,13 @@ To disable reordering of tests in a module or class, use pytest marker notation:
3738
3839 pytestmark = pytest.mark.random_order(disabled=True)
3940
41+ To rerun tests in a particular order:
42+
43+ ::
44+
45+ $ pytest -v --random-order-seed=<value-reported-in-previous-run>
46+
47+
4048Design
4149------
4250
@@ -118,6 +126,28 @@ No matter what will be the bucket type for the test run, ``test_number_one`` wil
118126before ``test_number_two ``.
119127
120128
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+
121151Disable the Plugin
122152++++++++++++++++++
123153
0 commit comments