[issue28276] test_loading.py - false positive result for "def test_find" when find_library() is not functional or the (shared) library does not exist

Michael Felt report at bugs.python.org
Tue Sep 27 15:17:34 EDT 2016


Michael Felt added the comment:

Actually, what may be needed are more "@skip" blocks - as ctypes has always been platform dependent.

OR - have a counter or boolean that starts as zero or false and increase each time find_library() returns a value - and the test fails if the counter is still zero, or boolean is still false.

Further, perhaps a separate test_load() that is platform specific - with the correct - read expected - result from find_library(). I say expected because python has always been testing for libc.so.6 while I see in cloud-init that that are calls hard-coded to CDLL("libc.so.7") - but maybe that is something specific for Canonical aka ubuntu.

However, it seems that expecting libc.so.6 to ALWAYS be present is not safe.

FYI:

michael at x071:[/data/prj/python/cloud-init]grep CDLL cloud-init-0*/cloudinit/*.py
cloud-init-0.7.5/cloudinit/util.py:            libc = ctypes.CDLL('/lib/libc.so.7')
cloud-init-0.7.8/cloudinit/util.py:            libc = ctypes.CDLL('/lib/libc.so.7')

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28276>
_______________________________________


More information about the Python-bugs-list mailing list