Skip to content

Commit 81a4714

Browse files
committed
TST: enable --fatal-meson-warnings for all tests
1 parent 7efa417 commit 81a4714

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tests/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,18 @@ def cleanenv():
192192
# $MACOSX_DEPLOYMENT_TARGET affects the computation of the platform tag on macOS.
193193
yield mpatch.delenv('MACOSX_DEPLOYMENT_TARGET', raising=False)
194194
mpatch.undo()
195+
196+
197+
@pytest.fixture(autouse=True, scope='session')
198+
def meson_fatal_warnings():
199+
# Cannot use the 'monkeypatch' fixture because of scope mismatch.
200+
mpatch = pytest.MonkeyPatch()
201+
mesonpy_project_init = mesonpy.Project.__init__
202+
203+
def __init__(self, source_dir, build_dir, meson_args=None, editable_verbose=False):
204+
if meson_args is None:
205+
meson_args = {}
206+
meson_args['setup'] = meson_args.get('setup', []) + ['--fatal-meson-warnings']
207+
mesonpy_project_init(self, source_dir, build_dir, meson_args, editable_verbose)
208+
209+
mpatch.setattr(mesonpy.Project, '__init__', __init__)

tests/test_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def test_ios_project(package_simple, monkeypatch, multiarch, tmp_path):
400400
project = mesonpy.Project(source_dir=package_simple, build_dir=tmp_path)
401401

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

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

0 commit comments

Comments
 (0)