validate:launcher: Do not sort tests all the time
authorThibault Saunier <tsaunier@igalia.com>
Sat, 9 Feb 2019 20:25:03 +0000 (17:25 -0300)
committerThibault Saunier <tsaunier@igalia.com>
Sat, 9 Feb 2019 20:25:03 +0000 (17:25 -0300)
Do it once only once it is fully populated

validate/launcher/baseclasses.py

index 419b025..7e351f3 100644 (file)
@@ -1203,11 +1203,9 @@ class TestsManager(Loggable):
         if self._is_test_wanted(test):
             if test not in self.tests:
                 self.tests.append(test)
-                self.tests.sort(key=lambda test: test.classname)
         else:
             if test not in self.tests:
                 self.unwanted_tests.append(test)
-                self.unwanted_tests.sort(key=lambda test: test.classname)
 
     def get_tests(self):
         return self.tests
@@ -1692,7 +1690,8 @@ class _TestsLauncher(Loggable):
                 raise RuntimeError("Unexpected new test in testsuite.")
 
             self.tests.extend(tests)
-        return sorted(list(self.tests), key=lambda t: t.classname)
+        self.tests.sort(key=lambda test: test.classname)
+        return self.tests
 
     def _tester_needed(self, tester):
         for testsuite in self.options.testsuites: