Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_findlib2 fails for unknown reason #1014

Open
olebole opened this issue Jun 30, 2023 · 1 comment
Open

test_findlib2 fails for unknown reason #1014

olebole opened this issue Jun 30, 2023 · 1 comment

Comments

@olebole
Copy link
Contributor

olebole commented Jun 30, 2023

When building the updated Debian package, the test_findlib2 fails:


    def test_findlib2():
        if not sys.platform.startswith("linux"):
            skip("test on linux only")
    
        # Candidate libs for common freeimage
        fi_dir = os.path.join(core.appdata_dir("imageio"), "freeimage")
        if not os.path.isdir(fi_dir):
            os.mkdir(fi_dir)
        dirs, paths = core.findlib.generate_candidate_libs(["libfreeimage"], [fi_dir])
        # assert fi_dir in dirs -> Cannot test: lib may not exist
    
        open(os.path.join(fi_dir, "notalib.test.so"), "wb")
    
        # Loading libs
        gllib = ctypes.util.find_library("GL")
>       core.load_lib([gllib], [])

tests/test_core.py:128: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exact_lib_names = [], lib_names = [], lib_dirs = None

    def load_lib(exact_lib_names, lib_names, lib_dirs=None):
        """…"""
    
        # Checks
        assert isinstance(exact_lib_names, list)
        assert isinstance(lib_names, list)
        if lib_dirs is not None:
            assert isinstance(lib_dirs, list)
        exact_lib_names = [n for n in exact_lib_names if n]
        lib_names = [n for n in lib_names if n]
    
        # Get reference name (for better messages)
        if lib_names:
            the_lib_name = lib_names[0]
        elif exact_lib_names:
            the_lib_name = exact_lib_names[0]
        else:
>           raise ValueError("No library name given.")
E           ValueError: No library name given.

imageio/core/findlib.py:113: ValueError
@FirefoxMetzger
Copy link
Contributor

Hm, looks like ctypes can't find libGL. I guess the test environment doesn't have it installed?

I haven't written this test, but I know that we don't need libGL in ImageIO. My guess is that this is an "arbitrary, commonly used library" that is being used to check if the logic works correctly. The fastest fix I can think of is to change it to another library that is more omnipresent on various OSes.

The proper fix is likely to rewrite this test to not depend on an arbitrary (unused/unrelated) lib to be present, but I don't know when I will find the time to dig into this option...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants