From a99e7272b8703e54b3c96ac0fdb7fe7eacfabbe8 Mon Sep 17 00:00:00 2001
From: Dan McGee <dan@archlinux.org>
Date: Sat, 22 Jan 2011 16:11:33 -0600
Subject: pactest: sort repos by alpha order in config file

The order was non-deterministic before, and just happened to work for
sync023.py as it was written. Ensure there is some sort of predictable
ordering.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
 test/pacman/tests/sync023.py | 3 ++-
 test/pacman/util.py          | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'test/pacman')

diff --git a/test/pacman/tests/sync023.py b/test/pacman/tests/sync023.py
index 8233ab73..3644c9de 100644
--- a/test/pacman/tests/sync023.py
+++ b/test/pacman/tests/sync023.py
@@ -15,7 +15,8 @@ for p in lp1, lp2, lp3, sp1, sp2, sp3, newp1:
 for p in lp1, lp2, lp3:
 	self.addpkg2db("local", p)
 
-self.addpkg2db("testing", newp1);
+# repos are sorted in alpha order
+self.addpkg2db("atesting", newp1);
 
 for p in sp1, sp2, sp3:
 	self.addpkg2db("sync", p);
diff --git a/test/pacman/util.py b/test/pacman/util.py
index 652467ae..359b42bf 100755
--- a/test/pacman/util.py
+++ b/test/pacman/util.py
@@ -125,8 +125,11 @@ def mkcfgfile(filename, root, option, db):
         data.extend(["%s = %s" % (key, j) for j in value])
 
     # Repositories
-    for key, value in db.iteritems():
+    # sort by repo name so tests can predict repo order, rather than be
+    # subjects to the whims of python dict() ordering
+    for key in sorted(db.iterkeys()):
         if key != "local":
+            value = db[key]
             data.append("[%s]\n" \
                     "Server = file://%s" \
                      % (value.treename,
-- 
cgit v1.2.3-70-g09d2