diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-09-03 18:18:18 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-09-03 18:18:18 +0200 |
| commit | 6809becd9c7dccc797dde7be2046cad55712c5de (patch) | |
| tree | d87b821698ab5164330b0e57ab897e8d050a18fa /tests/test_apt_cache.py | |
| parent | f438a6d0345bedd85f443e9943d3f76942feae02 (diff) | |
| download | python-apt-6809becd9c7dccc797dde7be2046cad55712c5de.tar.gz | |
not not depend on network when running the tests, some style fixes (thanks to Jak for the code-review)
Diffstat (limited to 'tests/test_apt_cache.py')
| -rw-r--r-- | tests/test_apt_cache.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 054ef8b2..22af97f2 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -94,20 +94,21 @@ class TestAptCache(unittest.TestCase): # test single sources.list fetching sources_list = "./data/tmp/test.list" - f=open(sources_list,"w") - f.write("deb http://archive.ubuntu.com/ubuntu lucid restricted\n") + f=open(sources_list, "w") + repo = os.path.abspath("./data/test-repo") + f.write("deb copy:%s /\n" % repo) f.close() self.assertTrue(os.path.exists(sources_list)) # write marker to ensure listcleaner is not run - open("./data/tmp/var/lib/apt/lists/marker","w") + open("./data/tmp/var/lib/apt/lists/marker", "w") # update a single sources.list cache = apt.Cache() cache.update(sources_list=sources_list) # verify we just got a single source - files = filter(lambda f: not (f == "lock" or f == "partial"), + files = filter(lambda f: f not in ("lock", "partial"), os.listdir("./data/tmp/var/lib/apt/lists")) - self.assertTrue("archive.ubuntu.com_ubuntu_dists_lucid_Release" in files) + self.assertEqual(len([f for f in files if f.endswith("tests_data_test-repo_Packages")]), 1) # ensure the listcleaner was not run self.assertTrue("marker" in files) # ensure we don't get additional stuff from /etc/apt/sources.list @@ -115,7 +116,7 @@ class TestAptCache(unittest.TestCase): # now run update again and verify that we got the normal sources.list cache.update() - full_update = filter(lambda f: not (f == "lock" or f == "partial"), + full_update = filter(lambda f: f not in ("lock", "partial"), os.listdir("./data/tmp/var/lib/apt/lists")) self.assertTrue(len(files) < len(full_update)) |
