Add test checking cibuildwheel detects when PATH is messed up by CIBW_ENVIRONMENT
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
import pytest
|
||||||
|
import subprocess
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
|
|
||||||
@@ -17,3 +18,15 @@ def test():
|
|||||||
# also check that we got the right wheels built
|
# also check that we got the right wheels built
|
||||||
expected_wheels = utils.expected_wheels('spam', '0.1.0')
|
expected_wheels = utils.expected_wheels('spam', '0.1.0')
|
||||||
assert set(actual_wheels) == set(expected_wheels)
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user