Modernize tests to use EXT_SUFFIX, fix PyPy

Modernize `test_generates_c_extensions` to use
`sysconfig.get_config_var("EXT_SUFFIX")` whenever available,
to obtain the correct extension file suffix, instead of attempting
to recontruct it from `SOABI`.  This fixes test failures on modern
PyPy3.10 versions, and should also be more future-proof for other Python
implementations.

Partial-Bug: 2097427
Change-Id: I5fbeb0ae1193ed68be0beab2857860a525731688
This commit is contained in:
Michał Górny
2025-02-05 11:26:55 +01:00
parent 5d4a1815af
commit e93bedd228

View File

@@ -413,9 +413,13 @@ class TestPackagingWheels(base.BaseTestCase):
built_package_dir = os.path.join(
self.extracted_wheel_dir, 'pbr_testpackage')
static_object_filename = 'testext.so'
soabi = get_soabi()
if soabi:
static_object_filename = 'testext.{0}.so'.format(soabi)
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
if ext_suffix is not None:
static_object_filename = 'testext' + ext_suffix
else:
soabi = get_soabi()
if soabi:
static_object_filename = 'testext.{0}.so'.format(soabi)
static_object_path = os.path.join(
built_package_dir, static_object_filename)