Use a different method for the Windows test

This commit is contained in:
Joe Rickerby
2020-07-05 17:27:29 +01:00
parent b12a560e87
commit cc913ee7cf
+11 -2
View File
@@ -54,9 +54,18 @@ def test_overridden_path(tmp_path, capfd):
# mess up PATH, somehow # mess up PATH, somehow
with pytest.raises(subprocess.CalledProcessError): with pytest.raises(subprocess.CalledProcessError):
if utils.platform == 'linux':
utils.cibuildwheel_run(project_dir, output_dir=output_dir, add_env={ utils.cibuildwheel_run(project_dir, output_dir=output_dir, add_env={
'CIBW_ENVIRONMENT': '''SOMETHING="$(mkdir -p new_path ; touch new_path/python ; chmod +x new_path/python)" PATH="$(pwd)/new_path:$PATH"''', 'CIBW_BEFORE_ALL': 'mkdir new_path && touch new_path/python && chmod +x new_path/python',
'CIBW_ENVIRONMENT_WINDOWS': '''SOMETHING="$(mkdir new_path ; fsutil file createnew new_path/python.exe 0)" PATH="$CD\\new_path;$PATH"''', 'CIBW_ENVIRONMENT': '''PATH="$(pwd)/new_path:$PATH"''',
})
else:
new_path = tmp_path / 'another_bin'
new_path.mkdir()
(new_path / 'python').touch(mode=0o777)
utils.cibuildwheel_run(project_dir, output_dir=output_dir, add_env={
'CIBW_ENVIRONMENT': f'''PATH="{new_path}{os.pathsep}$PATH"''',
}) })
assert len(os.listdir(output_dir)) == 0 assert len(os.listdir(output_dir)) == 0