diff --git a/py/test/collect.py b/py/test/collect.py index 231cfc2d1..58245dfa3 100644 --- a/py/test/collect.py +++ b/py/test/collect.py @@ -398,7 +398,7 @@ class Directory(FSCollector): if l is not None: return l l = [] - for path in self.fspath.listdir(): # listdir() returns sorted order + for path in self.fspath.listdir(sort=True): res = self.consider(path, usefilters=True) if res is not None: l.append(res) diff --git a/py/test/testing/test_collect.py b/py/test/testing/test_collect.py index de20a04a0..00e815f6e 100644 --- a/py/test/testing/test_collect.py +++ b/py/test/testing/test_collect.py @@ -87,7 +87,7 @@ class TestCollect(suptest.InlineCollection): def test_found_certain_testfiles(self): p1 = self.makepyfile(test_found = "pass", found_test="pass") col = py.test.collect.Directory(p1.dirpath(), config=dummyconfig) - items = col.collect() + items = col.collect() # Directory collect returns files sorted by name assert len(items) == 2 assert items[1].name == 'test_found.py' assert items[0].name == 'found_test.py'