Skip to content

Commit 1e69e7a

Browse files
dnicolodirgommers
authored andcommitted
TST: harden against environment variables affecting meson-python
Fixes #760.
1 parent 3d03c9c commit 1e69e7a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/test_tags.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ def get_abi3_suffix():
4040
ABI3SUFFIX = get_abi3_suffix()
4141

4242

43-
def test_wheel_tag():
43+
@pytest.fixture()
44+
def cleanenv(monkeypatch):
45+
# $MACOSX_DEPLOYMENT_TARGET affects the computation of the platform tag on macOS.
46+
monkeypatch.delenv('MACOSX_DEPLOYMENT_TARGET', raising=False)
47+
48+
49+
def test_wheel_tag(cleanenv):
4450
assert str(mesonpy._tags.Tag()) == f'{INTERPRETER}-{ABI}-{PLATFORM}'
4551
assert str(mesonpy._tags.Tag(abi='abi3')) == f'{INTERPRETER}-abi3-{PLATFORM}'
4652

@@ -112,14 +118,14 @@ def test_tag_purelib_wheel():
112118
assert str(builder.tag) == 'py3-none-any'
113119

114120

115-
def test_tag_platlib_wheel():
121+
def test_tag_platlib_wheel(cleanenv):
116122
builder = wheel_builder_test_factory({
117123
'platlib': [f'extension{SUFFIX}'],
118124
})
119125
assert str(builder.tag) == f'{INTERPRETER}-{ABI}-{PLATFORM}'
120126

121127

122-
def test_tag_stable_abi():
128+
def test_tag_stable_abi(cleanenv):
123129
builder = wheel_builder_test_factory({
124130
'platlib': [f'extension{ABI3SUFFIX}'],
125131
}, limited_api=True)
@@ -130,7 +136,7 @@ def test_tag_stable_abi():
130136

131137
@pytest.mark.xfail(sys.version_info < (3, 8) and sys.platform == 'win32', reason='Extension modules suffix without ABI tags')
132138
@pytest.mark.xfail('__pypy__' in sys.builtin_module_names, reason='PyPy does not support the stable ABI')
133-
def test_tag_mixed_abi():
139+
def test_tag_mixed_abi(cleanenv):
134140
builder = wheel_builder_test_factory({
135141
'platlib': [f'extension{ABI3SUFFIX}', f'another{SUFFIX}'],
136142
}, pure=False, limited_api=True)

0 commit comments

Comments
 (0)