style: activate string normalization
This commit is contained in:
committed by
Henry Schreiner
parent
d1900f6a05
commit
bda76b21cb
+15
-15
@@ -8,7 +8,7 @@ from . import test_projects, utils
|
||||
|
||||
project_with_environment_asserts = test_projects.new_c_project(
|
||||
setup_py_add=textwrap.dedent(
|
||||
r'''
|
||||
r"""
|
||||
import os
|
||||
|
||||
# explode if environment isn't correct, as set in CIBW_ENVIRONMENT
|
||||
@@ -27,13 +27,13 @@ project_with_environment_asserts = test_projects.new_c_project(
|
||||
raise Exception('PATH should contain "/opt/cibw_test_path". It was "%s"' % PATH)
|
||||
if "$PATH" in PATH:
|
||||
raise Exception('$PATH should be expanded in PATH. It was "%s"' % PATH)
|
||||
'''
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test(tmp_path):
|
||||
project_dir = tmp_path / 'project'
|
||||
project_dir = tmp_path / "project"
|
||||
project_with_environment_asserts.generate(project_dir)
|
||||
|
||||
# write some information into the CIBW_ENVIRONMENT, for expansion and
|
||||
@@ -42,19 +42,19 @@ def test(tmp_path):
|
||||
actual_wheels = utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
add_env={
|
||||
'CIBW_ENVIRONMENT': '''CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH=$PATH:/opt/cibw_test_path''',
|
||||
'CIBW_ENVIRONMENT_WINDOWS': '''CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH="$PATH;/opt/cibw_test_path"''',
|
||||
"CIBW_ENVIRONMENT": """CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH=$PATH:/opt/cibw_test_path""",
|
||||
"CIBW_ENVIRONMENT_WINDOWS": '''CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH="$PATH;/opt/cibw_test_path"''',
|
||||
},
|
||||
)
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
def test_overridden_path(tmp_path, capfd):
|
||||
project_dir = tmp_path / 'project'
|
||||
output_dir = tmp_path / 'output'
|
||||
project_dir = tmp_path / "project"
|
||||
output_dir = tmp_path / "output"
|
||||
|
||||
project = test_projects.new_c_project()
|
||||
project.generate(project_dir)
|
||||
@@ -62,26 +62,26 @@ def test_overridden_path(tmp_path, capfd):
|
||||
|
||||
# mess up PATH, somehow
|
||||
with pytest.raises(subprocess.CalledProcessError):
|
||||
if utils.platform == 'linux':
|
||||
if utils.platform == "linux":
|
||||
utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
output_dir=output_dir,
|
||||
add_env={
|
||||
'CIBW_BEFORE_ALL': 'mkdir new_path && touch new_path/python && chmod +x new_path/python',
|
||||
'CIBW_ENVIRONMENT': '''PATH="$(pwd)/new_path:$PATH"''',
|
||||
"CIBW_BEFORE_ALL": "mkdir new_path && touch new_path/python && chmod +x new_path/python",
|
||||
"CIBW_ENVIRONMENT": '''PATH="$(pwd)/new_path:$PATH"''',
|
||||
},
|
||||
)
|
||||
else:
|
||||
new_path = tmp_path / 'another_bin'
|
||||
new_path = tmp_path / "another_bin"
|
||||
new_path.mkdir()
|
||||
(new_path / 'python').touch(mode=0o777)
|
||||
(new_path / "python").touch(mode=0o777)
|
||||
|
||||
utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
output_dir=output_dir,
|
||||
add_env={
|
||||
'NEW_PATH': str(new_path),
|
||||
'CIBW_ENVIRONMENT': f'''PATH="$NEW_PATH{os.pathsep}$PATH"''',
|
||||
"NEW_PATH": str(new_path),
|
||||
"CIBW_ENVIRONMENT": f'''PATH="$NEW_PATH{os.pathsep}$PATH"''',
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user