From f7d22dc2e7964ce33415e53a81dfc62439111491 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 24 Nov 2010 10:46:40 +0100 Subject: * tests/test_apt_cache.py: - fix tests to work if apt compressed indexes are enabled --- tests/test_apt_cache.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index efa73a4f..0b33a2e3 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -18,6 +18,7 @@ sys.path.insert(0, get_library_dir()) import apt import apt_pkg import shutil +import glob class TestAptCache(unittest.TestCase): """ test the apt cache """ @@ -139,12 +140,11 @@ class TestAptCache(unittest.TestCase): cache = apt.Cache() cache.update(sources_list=sources_list) # verify we just got the excpected package file - needle_packages = [f for f in os.listdir(lists_dir) - if f.endswith("tests_data_test-repo_Packages")] + needle_packages = glob.glob( + lists_dir+"/*tests_data_test-repo_Packages*") self.assertEqual(len(needle_packages), 1) # verify that we *only* got the Packages file from a single source - all_packages = [f for f in os.listdir(lists_dir) - if f.endswith("_Packages")] + all_packages = glob.glob(lists_dir+"/*_Packages*") self.assertEqual(needle_packages, all_packages) # verify that the listcleaner was not run and the marker file is # still there @@ -153,18 +153,15 @@ class TestAptCache(unittest.TestCase): # now run update again (without the "normal" sources.list that # contains test-repo2 and verify that we got the normal sources.list cache.update() - needle_packages = [f for f in os.listdir(lists_dir) - if f.endswith("tests_data_test-repo2_Packages")] + needle_packages = glob.glob(lists_dir+"/*tests_data_test-repo2_Packages*") self.assertEqual(len(needle_packages), 1) - all_packages = [f for f in os.listdir(lists_dir) - if f.endswith("_Packages")] + all_packages = glob.glob(lists_dir+"/*_Packages*") self.assertEqual(needle_packages, all_packages) # and another update with a single source only cache = apt.Cache() cache.update(sources_list=sources_list) - all_packages = [f for f in os.listdir(lists_dir) - if f.endswith("_Packages")] + all_packages = glob.glob(lists_dir+"/*_Packages*") self.assertEqual(len(all_packages), 2) if __name__ == "__main__": -- cgit v1.2.3