dlinfo_test.py 524 B

12345678910111213141516171819202122
  1. import ctypes
  2. import os
  3. import pytest
  4. from dlinfo import DLInfo
  5. @pytest.mark.parametrize('lib_name', [
  6. 'c',
  7. 'dl',
  8. 'grasp_python',
  9. ])
  10. def test_dlinfo_path(lib_name):
  11. lib_filename = ctypes.util.find_library(lib_name)
  12. if not lib_filename:
  13. pytest.xfail('lib{} not found'.format(lib_name))
  14. lib = ctypes.cdll.LoadLibrary(lib_filename)
  15. dlinfo = DLInfo(lib)
  16. assert os.path.exists(dlinfo.path)
  17. assert os.path.isabs(dlinfo.path)
  18. assert lib_filename == os.path.basename(dlinfo.path)