Skip to content

Commit 9d7709a

Browse files
committed
TST: enable --fatal-meson-warnings for all tests
1 parent 73b7019 commit 9d7709a

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.setdefault('setup', []).append('--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
@@ -399,7 +399,7 @@ def test_ios_project(package_simple, monkeypatch, multiarch, tmp_path):
399399
project = mesonpy.Project(source_dir=package_simple, build_dir=tmp_path)
400400

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

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

0 commit comments

Comments
 (0)