Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,18 @@ def cleanenv():
# $MACOSX_DEPLOYMENT_TARGET affects the computation of the platform tag on macOS.
yield mpatch.delenv('MACOSX_DEPLOYMENT_TARGET', raising=False)
mpatch.undo()


@pytest.fixture(autouse=True, scope='session')
def meson_fatal_warnings():
# Cannot use the 'monkeypatch' fixture because of scope mismatch.
mpatch = pytest.MonkeyPatch()
mesonpy_project_init = mesonpy.Project.__init__

def __init__(self, source_dir, build_dir, meson_args=None, editable_verbose=False):
if meson_args is None:
meson_args = {}
meson_args.setdefault('setup', []).append('--fatal-meson-warnings')
mesonpy_project_init(self, source_dir, build_dir, meson_args, editable_verbose)

mpatch.setattr(mesonpy.Project, '__init__', __init__)
2 changes: 1 addition & 1 deletion tests/packages/limited-api/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

project('limited-api', 'c', version: '1.0.0')
project('limited-api', 'c', version: '1.0.0', meson_version: '>= 1.3')

py = import('python').find_installation(pure: false)

Expand Down
5 changes: 1 addition & 4 deletions tests/packages/subproject/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ requires = ['meson-python']

[tool.meson-python.wheel]
exclude = [
# Meson before version 1.3.0 install data files in
# ``{datadir}/{project name}/``, later versions install
# in the more correct ``{datadir}/{subproject name}/``.
'{datadir}/*/data.txt',
'{datadir}/sub/*.txt',
'{py_purelib}/dep.*',
]
include = [
Expand Down
2 changes: 1 addition & 1 deletion tests/packages/subproject/subprojects/dep/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ py = import('python').find_installation()

py.install_sources('dep.py')

install_data('data.txt')
install_data('data.txt', install_dir: 'dep')
2 changes: 1 addition & 1 deletion tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def test_ios_project(package_simple, monkeypatch, multiarch, tmp_path):
project = mesonpy.Project(source_dir=package_simple, build_dir=tmp_path)

# Meson configuration points at the cross file
assert project._meson_args['setup'] == ['--cross-file', os.fspath(tmp_path / 'meson-python-cross-file.ini')]
assert project._meson_args['setup'][-2:] == ['--cross-file', os.fspath(tmp_path / 'meson-python-cross-file.ini')]

# Meson config files exist, and have some relevant keys
assert (tmp_path / 'meson-python-native-file.ini').exists()
Expand Down
Loading