From 101b24520e7d73990d43c5a32186ed4c49561541 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 24 Jan 2009 18:28:27 +0000 Subject: [PATCH] Tests for RPMDistribution --- tests/rpm/rpm | 5 +++++ tests/rpm/status | 0 tests/testdistro.py | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 tests/rpm/rpm create mode 100644 tests/rpm/status diff --git a/tests/rpm/rpm b/tests/rpm/rpm new file mode 100755 index 0000000..b9bcfb0 --- /dev/null +++ b/tests/rpm/rpm @@ -0,0 +1,5 @@ +#!/bin/sh +cat << EOF +yast2-update 2.15.23-21 i586 +yast2-mail 2.15.23-2 noarch +EOF diff --git a/tests/rpm/status b/tests/rpm/status new file mode 100644 index 0000000..e69de29 diff --git a/tests/testdistro.py b/tests/testdistro.py index 938e06c..df9dcf5 100755 --- a/tests/testdistro.py +++ b/tests/testdistro.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2.4 from basetest import BaseTest, empty_feed -import sys +import sys, os import unittest sys.path.insert(0, '..') @@ -42,6 +42,19 @@ class TestDistro(BaseTest): libxcomposite = self.feed.implementations['package:deb:libxcomposite-dev:0.3.1-1'] self.assertEquals('0.3.1-1', libxcomposite.get_version()) + def testRPM(self): + rpmdir = os.path.join(os.path.dirname(__file__), 'rpm') + os.environ['PATH'] = rpmdir + ':' + self.old_path + rpm = distro.RPMDistribution(os.path.join(rpmdir, 'status')) + + self.assertEquals(2, len(rpm.versions)) + + rpm.get_package_info('yast2-update', self.factory) + self.assertEquals(1, len(self.feed.implementations)) + yast = self.feed.implementations['package:rpm:yast2-update:2.15.23-21'] + self.assertEquals('2.15.23-21', yast.get_version()) + self.assertEquals('*-i586', yast.arch) + def testCleanVersion(self): self.assertEquals('1', distro.try_cleanup_distro_version('1:0.3.1-1')) self.assertEquals('0.3.1-1', distro.try_cleanup_distro_version('0.3.1-1ubuntu0')) -- 2.11.4.GIT