diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-12 14:10:40 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-12 14:10:40 +0200 |
| commit | f75c59b6b250d14b1e52e1eebebfb5b11482d2ef (patch) | |
| tree | 07fb10c7a2e4df4e1f3c1ab3675c2a2f59c3b1c1 /tests | |
| parent | b94455e7afd0e08ce1a8aab890dbee0d42566d7b (diff) | |
| download | python-apt-f75c59b6b250d14b1e52e1eebebfb5b11482d2ef.tar.gz | |
tests/test_debfile.py: add fixture dpkg-status file to make tests work
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_debfile.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 56bbba9f..6af0cf1c 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -13,10 +13,9 @@ import unittest from test_all import get_library_dir import sys sys.path.insert(0, get_library_dir()) - +import apt_pkg import apt.debfile - class TestDebfilee(unittest.TestCase): """ test the apt cache """ @@ -44,13 +43,21 @@ class TestDebfilee(unittest.TestCase): ('gdebi-test10.deb', False), ] + def setUp(self): + apt_pkg.config.set("APT::Architecture","i386") + apt_pkg.config.set("Dir::State::status", + "./test_debs/var/lib/dpkg/status") + self.cache = apt.Cache() + def testDebFile(self): - deb = apt.debfile.DebPackage() + deb = apt.debfile.DebPackage(cache=self.cache) for (filename, expected_res) in self.TEST_DEBS: logging.debug("testing %s, expecting %s" % (filename, expected_res)) deb.open(os.path.join("test_debs", filename)) res = deb.check() - self.assertEqual(res, expected_res) + self.assertEqual(res, expected_res, + "Unexpected result for package '%s' (got %s wanted %s)" % ( + filename, res, expected_res)) if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) |
