Skip to content

Commit

Permalink
TST: extend local lib test to verify Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolodi committed Feb 12, 2025
1 parent 900b5cf commit 261cbf2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions tests/packages/link-against-local-lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os

_path = os.path.join(os.path.dirname(__file__), '..', '.example.meson-libs')
if os.name == 'nt':
os.add_dll_directory(_path)
elif sys.platform == 'cygwin':
os.environ['PATH'] = os.pathsep.join((os.environ['PATH'], _path))
del _path

from _example import *
8 changes: 7 additions & 1 deletion tests/packages/link-against-local-lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ subdir('lib')

py = import('python').find_installation()

py.install_sources(
'__init__.py',
subdir: 'example',
)

py.extension_module(
'example',
'_example',
'examplemod.c',
link_with: example_lib,
link_args: ['-Wl,-rpath,custom-rpath'],
install: true,
subdir: 'example',
)
3 changes: 3 additions & 0 deletions tests/packages/link-against-local-lib/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
[build-system]
build-backend = 'mesonpy'
requires = ['meson-python']

[tool.meson-python]
allow-windows-internal-shared-libs = true
1 change: 0 additions & 1 deletion tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def test_contents(package_library, wheel_library):
}


@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
def test_local_lib(venv, wheel_link_against_local_lib):
venv.pip('install', wheel_link_against_local_lib)
output = venv.python('-c', 'import example; print(example.example_sum(1, 2))')
Expand Down

0 comments on commit 261cbf2

Please sign in to comment.