[Yum-devel] [PATCH] Add new rpmUtils updates tests

John Haxby jch at thehaxbys.co.uk
Mon Apr 22 12:02:27 UTC 2013


Also allow more flexible testing.  In particular, setting
rpmUtils.arch.canonArch=\'sparc64v\' illustrated a problem with
complex update for kernel.sparc64.
---
 rpmUtils/tests/updates-test.py | 64 +++++++++++++++++++++++++-----------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/rpmUtils/tests/updates-test.py b/rpmUtils/tests/updates-test.py
index 889353e..7373f6a 100644
--- a/rpmUtils/tests/updates-test.py
+++ b/rpmUtils/tests/updates-test.py
@@ -1,37 +1,51 @@
 
 import rpmUtils.updates
 import rpmUtils.arch
+import sys
 
-instlist = [('foo', 'i386', '0', '1', '1'),
-            ('do', 'i386', '0', '2', '3'),
-            ('glibc', 'i386', '0', '1', '1'),
-            ('bar', 'noarch', '0', '2', '1'),
-            ('baz', 'i686', '0', '2', '3'),
-            ('baz', 'x86_64', '0','1','4'),
-            ('foo', 'i686', '0', '1', '1'),
-            ('cyrus-sasl','sparcv9', '0', '1', '1')]
-
-availlist = [('foo', 'i686', '0', '1', '3'),
-             ('do', 'noarch', '0', '3', '3'), 
-             ('do', 'noarch', '0', '4', '3'),
-             ('foo', 'i386', '0', '1', '3'),
-             ('foo', 'i686', '0', '1', '2'),
-             ('glibc', 'i686', '0', '1', '2'),
-             ('glibc', 'i386', '0', '1', '2'),
-             ('bar', 'noarch', '0', '2', '2'),
-             ('baz', 'noarch', '0', '2', '4'),
-             ('baz', 'i686', '0', '2', '4'),
-             ('baz', 'x86_64', '0', '1', '5'),
+i386 = 'i386'
+i686 = 'i686'
+x86_64 = 'x86_64'
+noarch = 'noarch'
+sparcv9 = 'sparcv9'
+sparc64 = 'sparc64'
+# Passing arguments like rpmUtils.arch.canonArch=\'sparc64v\' or
+# sparc64=x86_64 lets you modify the test environment
+for arg in sys.argv[1:]:
+    exec arg
+
+instlist = [('foo', i386, '0', '1', '1'),
+            ('do', i386, '0', '2', '3'),
+            ('glibc', i386, '0', '1', '1'),
+            ('bar', noarch, '0', '2', '1'),
+            ('baz', i686, '0', '2', '3'),
+            ('baz', x86_64, '0','1','4'),
+            ('foo', i686, '0', '1', '1'),
+            ('cyrus-sasl',sparcv9, '0', '1', '1'),
+            ('kernel', sparc64, '0', '1', '1'),
+            ('kernel', sparc64, '0', '1', '2')]
+
+availlist = [('foo', i686, '0', '1', '3'),
+             ('do', noarch, '0', '3', '3'), 
+             ('do', noarch, '0', '4', '3'),
+             ('foo', i386, '0', '1', '3'),
+             ('foo', i686, '0', '1', '2'),
+             ('glibc', i686, '0', '1', '2'),
+             ('glibc', i386, '0', '1', '2'),
+             ('bar', noarch, '0', '2', '2'),
+             ('baz', noarch, '0', '2', '4'),
+             ('baz', i686, '0', '2', '4'),
+             ('baz', x86_64, '0', '1', '5'),
              ('baz', 'ppc', '0', '1', '5'),
-             ('cyrus-sasl','sparcv9', '0', '1', '2'),
-             ('cyrus-sasl','sparc64', '0', '1', '2'),]
+             ('cyrus-sasl',sparcv9, '0', '1', '2'),
+             ('cyrus-sasl',sparc64, '0', '1', '2'),
+             ('kernel', sparc64, '0', '1', '3')]
 
-obslist = {('quux', 'noarch', '0', '1', '3'): [('bar', None, (None, None, None))],
+obslist = {('quux', noarch, '0', '1', '3'): [('bar', None, (None, None, None))],
 
-           ('quuxish', 'noarch', '0', '1', '3'):[('foo', 'GE', ('0', '1', None))],
+           ('quuxish', noarch, '0', '1', '3'):[('foo', 'GE', ('0', '1', None))],
            }
            
-
 up = rpmUtils.updates.Updates(instlist, availlist)
 up.debug=1
 up.exactarch=1
-- 
1.8.1.4



More information about the Yum-devel mailing list