diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-02 16:46:35 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-02 16:46:35 +0200 |
| commit | 465b19e6ae3c6daeee0841d38ac93e0c19991c13 (patch) | |
| tree | fe7105c64632ccc9dc22520b6d70a18d5342c97b /tests/test_progress.py | |
| parent | 5a6c646ceffab7ce58106eccdccf884b6d332d58 (diff) | |
| parent | dd86db9ddb22b43867b5b4dc211f4440dec7aa6a (diff) | |
| download | python-apt-465b19e6ae3c6daeee0841d38ac93e0c19991c13.tar.gz | |
* merged lp:~kiwinote/python-apt/merge-gdebi-changes, this port the
DebPackage class fixes from gdebi into python-apt so that gdebi can
use the class from python-apt directly
* apt/debfile.py:
- check if the debfiles provides are in conflict with the systems
packages
* tests/test_debs/*.deb, tests/test_debfile.py:
- add automatic test based on the test debs from gdebi
Diffstat (limited to 'tests/test_progress.py')
| -rw-r--r-- | tests/test_progress.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_progress.py b/tests/test_progress.py new file mode 100644 index 00000000..2ab8ce5e --- /dev/null +++ b/tests/test_progress.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# +# Copyright (C) 2010 Michael Vogt <mvo@ubuntu.com> +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +"""Unit tests for verifying the correctness of apt.progress""" +import unittest + +import apt +import apt_pkg +import os + +class TestAcquireProgress(apt.progress.base.AcquireProgress): + def pulse(self, owner): + self.pulsed = True + +class TestProgress(unittest.TestCase): + + def setUp(self): + basedir = os.path.abspath(os.path.dirname(__file__)) + # setup apt_pkg config + apt_pkg.init() + apt_pkg.config.set("APT::Architecture", "amd64") + apt_pkg.config.set("Dir::Etc", basedir) + apt_pkg.config.set("Dir::Etc::sourceparts", "/xxx") + # setup lists dir + if not os.path.exists("./tmp/partial"): + os.makedirs("./tmp/partial") + apt_pkg.config.set("Dir::state::lists", "./tmp") + # create artifical line + deb_line = "deb file:%s/data/fake-packages/ /\n" % basedir + open("fetch_sources.list","w").write(deb_line) + apt_pkg.config.set("Dir::Etc::sourcelist", "fetch_sources.list") + + def test_acquire_progress(self): + progress = TestAcquireProgress() + cache = apt.Cache() + res = cache.update(progress) + self.assertTrue(progress.pulsed) + +if __name__ == "__main__": + unittest.main() |
