Commit c317a82
committed
tests: rework the test for freetype-py
Rework the test for `freetype-py` to accommodate scenarios where the
`freetype` shared library is not originally bundled with the package.
In such cases, `freetype-py` uses `ctypes.util.find_library()` to
discover and load system copy of the `freetype` shared library. This
is also picked up by PyInstaller's `ctypes` analysis; the said
shared library is collected into top-level application directory, and
successfully loaded at run-time.
But as far as the test goes, on Linux (and other POSIX systems except for
macOS), we cannot use the `freetype.FT_Library_filename` variable to
verify that the bundled copy from top-level application is used, because
`ctypes.util.find_library()` does not resolve full paths. Therefore, we
need the test to use `psutil` to dump the list of loaded shared libraries
once `freetype` is imported.
On the other hand, the required `psutil.memory_maps()` function is
unavailable on macOS. But thankfully, `ctypes.util.find_library()` on
macOS does resolve full library paths, so the original test based on
`freetype.FT_Library_filename` should work with both PyPI wheel
(package-bundled shared library) and Homebrew-installed `freetype-py`
(shared library collected from Homebrew library directory).
So in the end, we need two test variants; the original one for macOS
and a new `psutil`-based one for all other POSIX platforms. On Windows,
we can use either variant, as `psutil.memory_maps()` is available and
`ctypes.util.find_library()` resolves full library paths.1 parent 3c5a4bf commit c317a82
1 file changed
Lines changed: 61 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
1930 | 1930 | | |
1931 | 1931 | | |
1932 | 1932 | | |
| 1933 | + | |
| 1934 | + | |
1933 | 1935 | | |
1934 | | - | |
1935 | | - | |
1936 | | - | |
1937 | | - | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
1938 | 1950 | | |
1939 | | - | |
| 1951 | + | |
1940 | 1952 | | |
1941 | | - | |
1942 | | - | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
1943 | 1958 | | |
1944 | | - | |
1945 | | - | |
1946 | | - | |
1947 | | - | |
1948 | | - | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
1949 | 1973 | | |
1950 | | - | |
1951 | | - | |
1952 | | - | |
1953 | | - | |
1954 | | - | |
1955 | | - | |
1956 | | - | |
1957 | | - | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
1958 | 1998 | | |
1959 | 1999 | | |
1960 | 2000 | | |
| |||
0 commit comments