Add test checking cibuildwheel detects when PATH is messed up by CIBW_ENVIRONMENT

This commit is contained in:
Yannick Jadoul
2020-02-20 00:16:09 +01:00
parent 42a231f830
commit 2ce304d5d9
+14 -1
View File
@@ -1,5 +1,6 @@
import os
import pytest
import subprocess
import utils
@@ -17,3 +18,15 @@ def test():
# also check that we got the right wheels built
expected_wheels = utils.expected_wheels('spam', '0.1.0')
assert set(actual_wheels) == set(expected_wheels)
def test_overridden_path(tmp_path):
project_dir = os.path.dirname(__file__)
# mess up PATH, somehow
with pytest.raises(subprocess.CalledProcessError):
utils.cibuildwheel_run(project_dir, output_dir=tmp_path, add_env={
'CIBW_ENVIRONMENT': '''SOMETHING="$(mkdir new_path && touch new_path/python)" PATH="$(realpath new_path):$PATH"''',
'CIBW_ENVIRONMENT_WINDOWS': '''SOMETHING="$(mkdir new_path && type nul > new_path/python.exe)" PATH="$CD\\new_path;$PATH"''',
})
assert len(os.listdir(str(tmp_path))) == 0