Skip to content

BUG: Test failure in test_configtool_pkgconfigdir due to unresolved symlink in build environment #29434

@sobue-code

Description

@sobue-code

Describe the issue:

The test TestNumpyConfig.test_configtool_pkgconfigdir fails during NumPy build in a virtual environment on systems where Python is configured with --with-platlibdir=lib64 and lib64 is a symlink to lib. The test compares a resolved pkgconfigdir path from _configtool.py (pointing to lib) with an unresolved PKG_CONFIG_DIR (pointing to lib64), causing an assertion error.

Reproduce the code example:

import subprocess
import pathlib
from numpy.tests.test_configtool import TestNumpyConfig, PKG_CONFIG_DIR

test = TestNumpyConfig()
stdout = test.check_numpyconfig('--pkgconfigdir')
assert pathlib.Path(stdout) == PKG_CONFIG_DIR

# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
# AssertionError

Error message:

=================================== FAILURES ===================================
_________________ TestNumpyConfig.test_configtool_pkgconfigdir _________________

self = <numpy.tests.test_configtool.TestNumpyConfig object at 0x7f2b10463950>

    def test_configtool_pkgconfigdir(self):
        stdout = self.check_numpyconfig('--pkgconfigdir')
>       assert pathlib.Path(stdout) == PKG_CONFIG_DIR
E       AssertionError: assert PosixPath('/usr/src/RPM/BUILD/python3-module-numpy-2.3.1/.run_venv/lib/python3/site-packages/numpy/_core/lib/pkgconfig') == PosixPath('/usr/src/RPM/BUILD/python3-module-numpy-2.3.1/.run_venv/lib64/python3/site-packages/numpy/_core/lib/pkgconfig')
E        +  where PosixPath('/usr/src/RPM/BUILD/python3-module-numpy-2.3.1/.run_venv/lib/python3/site-packages/numpy/_core/lib/pkgconfig') = <class 'pathlib.Path'>('/usr/src/RPM/BUILD/python3-module-numpy-2.3.1/.run_venv/lib/python3/site-packages/numpy/_core/lib/pkgconfig')
E        +    where <class 'pathlib.Path'> = pathlib.Path

../.run_venv/lib64/python3/site-packages/numpy/tests/test_configtool.py:36: AssertionError

Python and NumPy Versions:

2.3.1
3.12.11 (main, Jul 12 2025, 16:50:29) [GCC 14.2.1 20241028 (ALT Sisyphus 14.2.1-alt1)]

Runtime Environment:

[{'numpy_version': '2.3.1',
'python': '3.12.11 (main, Jul 12 2025, 16:50:29) [GCC 14.2.1 20241028 (ALT '
'Sisyphus 14.2.1-alt1)]',
'uname': uname_result(system='Linux', node='localhost.localdomain', release='6.12.11-6.12-alt1', version='#1 SMP PREEMPT_DYNAMIC Fri Jan 31 06:35:42 UTC 2025', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': [],
'not_found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL',
'AVX512_SPR']}},
{'architecture': 'Prescott',
'filepath': '/usr/lib64/libopenblasp-r0.3.30.so',
'internal_api': 'openblas',
'num_threads': 4,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.30'}]

Context for the issue:

The failure occurs in build environments where Python is configured with --with-platlibdir=lib64 (e.g., ALT Linux), and lib64 is a symlink to lib, causing a path mismatch in the test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions