summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2011-04-06 10:09:19 +0200
committerJulian Andres Klode <jak@debian.org>2011-04-06 10:09:19 +0200
commit82bd14484ffa3fbe0b68777402cb31000bd7dd22 (patch)
tree70da06b97b1827a86883ef5e1d87842ebb23b1e9 /tests
parentef797f74a1948be2231a28786d2c40d047f9c49d (diff)
downloadpython-apt-82bd14484ffa3fbe0b68777402cb31000bd7dd22.tar.gz
aptsources: Parse multi-arch sources.list files correctly
Diffstat (limited to 'tests')
-rw-r--r--tests/data/aptsources/sources.list5
-rw-r--r--tests/test_aptsources.py19
2 files changed, 21 insertions, 3 deletions
diff --git a/tests/data/aptsources/sources.list b/tests/data/aptsources/sources.list
index 5481d4f0..376d6961 100644
--- a/tests/data/aptsources/sources.list
+++ b/tests/data/aptsources/sources.list
@@ -3,4 +3,7 @@ deb http://de.archive.ubuntu.com/ubuntu/ edgy main
# comment 2
deb http://de.archive.ubuntu.com/ubuntu/ edgy restricted
# comment 3
-deb http://de.archive.ubuntu.com/ubuntu/ edgy universe \ No newline at end of file
+deb http://de.archive.ubuntu.com/ubuntu/ edgy universe
+
+# multi-arch
+deb [arch=amd64,i386] http://de.archive.ubuntu.com/ubuntu/ natty main
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index 331df935..aeb2ce31 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -39,11 +39,11 @@ class TestAptSources(unittest.TestCase):
apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/"
"sources.list")
sources = aptsources.sourceslist.SourcesList(True, self.templates)
- self.assertEqual(len(sources.list), 6)
+ self.assertEqual(len(sources.list), 9)
# test load
sources.list = []
sources.load("data/aptsources/sources.list")
- self.assertEqual(len(sources.list), 6)
+ self.assertEqual(len(sources.list), 9)
def testSourcesListAdding(self):
"""aptsources: Test additions to sources.list"""
@@ -108,6 +108,21 @@ class TestAptSources(unittest.TestCase):
if not s.template:
self.fail("source entry '%s' has no matcher" % s)
+ def testMultiArch(self):
+ """aptsources: Test multi-arch parsing"""
+
+ apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/"
+ "sources.list")
+ sources = aptsources.sourceslist.SourcesList(True, self.templates)
+
+ assert sources.list[8].invalid == False
+ assert sources.list[8].type == "deb"
+ assert sources.list[8].architectures == ["amd64", "i386"]
+ assert sources.list[8].uri == "http://de.archive.ubuntu.com/ubuntu/"
+ assert sources.list[8].dist == "natty"
+ assert sources.list[8].comps == ["main"]
+ assert sources.list[8].line.strip() == str(sources.list[8])
+
def testDistribution(self):
"""aptsources: Test distribution detection."""
apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/"