diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_all.py | 8 | ||||
| -rw-r--r-- | tests/test_apt_cache.py | 17 |
2 files changed, 15 insertions, 10 deletions
diff --git a/tests/test_all.py b/tests/test_all.py index d6370747..091581f8 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -9,6 +9,14 @@ import os import unittest import sys +# workaround for py3.2 that apparently does not have this anymore +# it has "abiflags" +if not hasattr(sys, "pydebug"): + if sys.abiflags.startswith("d"): + sys.pydebug = True + else: + sys.pydebug = False + def get_library_dir(): # Find the path to the built apt_pkg and apt_inst extensions if not os.path.exists("../build"): 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__": |
