diff options
author | Rémi Cardona <remi.cardona@logilab.fr> | 2015-07-01 14:40:15 +0200 |
---|---|---|
committer | Rémi Cardona <remi.cardona@logilab.fr> | 2015-07-01 14:40:15 +0200 |
commit | e39ddf48a1ad28ddd07c38bef4ae436b7e94bf8b (patch) | |
tree | c86ea9ae886a78684b369c92399c9e8a6c163046 | |
parent | a1db2338d64311aa4564109de6aad85ad975b576 (diff) | |
download | logilab-common-e39ddf48a1ad28ddd07c38bef4ae436b7e94bf8b.tar.gz |
[pytest] Randomize tests order when using -t (closes #295922)
To help spot tests that are not fully independent of one another.
-rw-r--r-- | logilab/common/pytest.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/logilab/common/pytest.py b/logilab/common/pytest.py index c0983ed..3d8aca3 100644 --- a/logilab/common/pytest.py +++ b/logilab/common/pytest.py @@ -120,6 +120,7 @@ import warnings import types from inspect import isgeneratorfunction, isclass from contextlib import contextmanager +from random import shuffle from logilab.common.fileutils import abspath_listdir from logilab.common import textutils @@ -391,7 +392,9 @@ class PyTester(object): return true when all tests has been executed, false if exitfirst and some test has failed. """ - for filename in abspath_listdir(testdir): + files = abspath_listdir(testdir) + shuffle(files) + for filename in files: if this_is_a_testfile(filename): if self.options.exitfirst and not self.options.restart: # overwrite restart file |