summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/loader.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/loader.py')
-rw-r--r--Lib/unittest/loader.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py
index 2077fa3..25a9122 100644
--- a/Lib/unittest/loader.py
+++ b/Lib/unittest/loader.py
@@ -177,6 +177,9 @@ class TestLoader(object):
The pattern is deliberately not stored as a loader attribute so that
packages can continue discovery themselves. top_level_dir is stored so
load_tests does not need to pass this argument in to loader.discover().
+
+ Paths are sorted before being imported to ensure reproducible execution
+ order even on filesystems with non-alphabetical ordering like ext3/4.
"""
set_implicit_top = False
if top_level_dir is None and self._top_level_dir is not None:
@@ -253,7 +256,7 @@ class TestLoader(object):
def _find_tests(self, start_dir, pattern):
"""Used by discovery. Yields test suites it loads."""
- paths = os.listdir(start_dir)
+ paths = sorted(os.listdir(start_dir))
for path in paths:
full_path = os.path.join(start_dir, path)