Skip to content

Commit

Permalink
Create a fixture to patch-out compiler customization on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 2, 2024
1 parent 2175fdf commit a4220c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,10 @@ def temp_home(tmp_path, monkeypatch):
def fake_home(fs, monkeypatch):
home = fs.create_dir('/fakehome')
return _set_home(monkeypatch, pathlib.Path(home.path))


@pytest.fixture
def disable_macos_customization(monkeypatch):
from distutils import sysconfig

monkeypatch.setattr(sysconfig, '_customize_macos', lambda: None)
3 changes: 1 addition & 2 deletions distutils/tests/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ def set_executables(self, **kw):
'CCSHARED': '--sc-ccshared',
'LDSHARED': 'sc_ldshared',
'SHLIB_SUFFIX': 'sc_shutil_suffix',
# On macOS, disable _osx_support.customize_compiler()
'CUSTOMIZED_OSX_COMPILER': 'True',
}

comp = compiler()
Expand All @@ -111,6 +109,7 @@ def set_executables(self, **kw):
return comp

@pytest.mark.skipif("get_default_compiler() != 'unix'")
@pytest.mark.usefixtures('disable_macos_customization')
def test_customize_compiler(self):
# Make sure that sysconfig._config_vars is initialized
sysconfig.get_config_vars()
Expand Down

0 comments on commit a4220c0

Please sign in to comment.