Skip to content

Commit 5f1d979

Browse files
committed
Merge failing test commit 'f448b' into bugfix/178-include-posix-prefix
2 parents ff9b6d1 + f448b95 commit 5f1d979

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

distutils/tests/test_sysconfig.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,22 @@ def test_win_build_venv_from_source_tree(self, tmp_path):
297297
cmd, env={**os.environ, "PYTHONPATH": distutils_path}
298298
)
299299
assert out == "True"
300+
301+
def test_get_python_inc_missing_config_dir(self, monkeypatch):
302+
"""
303+
In portable Python installations, the sysconfig will be broken,
304+
pointing to the directories where the installation was built and
305+
not where it currently is. In this case, ensure that the missing
306+
directory isn't used for get_python_inc.
307+
308+
See pypa/distutils#178.
309+
"""
310+
311+
def override(name):
312+
if name == 'INCLUDEPY':
313+
return '/does-not-exist'
314+
return sysconfig.get_config_var(name)
315+
316+
monkeypatch.setattr(sysconfig, 'get_config_var', override)
317+
318+
assert os.path.exists(sysconfig.get_python_inc())

0 commit comments

Comments
 (0)