summaryrefslogtreecommitdiff
path: root/tests/test_apt_cache.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-12-11 15:32:02 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2012-12-11 15:32:02 +0100
commit610c1592a0118483651e66d12eea51df0624ebc1 (patch)
treef4ce184c0418eccd47bcde40df1063a4430c6f88 /tests/test_apt_cache.py
parent2ad969f628aee2948a12f8c3ba03572646ac4c5f (diff)
parentc7eb97c2fc8e2f4d3a7e41ac615382657eb95d49 (diff)
downloadpython-apt-610c1592a0118483651e66d12eea51df0624ebc1.tar.gz
merged test-fixes from ubuntu (mostly for dep8)
Diffstat (limited to 'tests/test_apt_cache.py')
-rw-r--r--tests/test_apt_cache.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index 7e2ead2d..21dfeb98 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -23,7 +23,9 @@ else:
from test_all import get_library_dir
-sys.path.insert(0, get_library_dir())
+libdir = get_library_dir()
+if libdir:
+ sys.path.insert(0, libdir)
import apt
import apt_pkg
@@ -34,7 +36,7 @@ def if_sources_list_is_readable(f):
if os.access("/etc/apt/sources.list", os.R_OK):
f(*args, **kwargs)
else:
- logging.warn("skipping '%s' because sources.list is not readable" % f)
+ logging.warning("skipping '%s' because sources.list is not readable" % f)
return wrapper
@@ -42,7 +44,7 @@ def get_open_file_descriptors():
try:
fds = os.listdir("/proc/self/fd")
except OSError:
- logging.warn("failed to list /proc/self/fd")
+ logging.warning("failed to list /proc/self/fd")
return set([])
return set(map(int, fds))
@@ -57,6 +59,8 @@ class TestAptCache(TestCase):
self._cnf = {}
for item in apt_pkg.config.keys():
self._cnf[item] = apt_pkg.config.find(item)
+ apt_pkg.config.clear("APT::Update::Post-Invoke")
+ apt_pkg.config.clear("APT::Update::Post-Invoke-Success")
def tearDown(self):
for item in self._cnf:
@@ -120,7 +124,7 @@ class TestAptCache(TestCase):
cache = apt.Cache(rootdir="./data/test-provides/")
cache.open()
if len(cache) == 0:
- logging.warn("skipping test_get_provided_packages, cache empty?!?")
+ logging.warning("skipping test_get_provided_packages, cache empty?!?")
return
# a true virtual pkg
l = cache.get_providing_packages("mail-transport-agent")
@@ -133,7 +137,7 @@ class TestAptCache(TestCase):
# create highlevel cache and get the lowlevel one from it
highlevel_cache = apt.Cache(rootdir="./data/test-provides")
if len(highlevel_cache) == 0:
- logging.warn("skipping test_log_level_pkg_provides, cache empty?!?")
+ logging.warning("skipping test_log_level_pkg_provides, cache empty?!?")
return
# low level cache provides list of the pkg
cache = highlevel_cache._cache