style: activate string normalization
This commit is contained in:
committed by
Henry Schreiner
parent
d1900f6a05
commit
bda76b21cb
+14
-14
@@ -7,7 +7,7 @@ from . import test_projects, utils
|
||||
|
||||
project_with_before_build_asserts = test_projects.new_c_project(
|
||||
setup_py_add=textwrap.dedent(
|
||||
r'''
|
||||
r"""
|
||||
import os
|
||||
|
||||
# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step
|
||||
@@ -27,17 +27,17 @@ project_with_before_build_asserts = test_projects.new_c_project(
|
||||
print('sys.executable', sys.executable)
|
||||
# windows/mac are case insensitive
|
||||
assert os.path.realpath(stored_executable).lower() == os.path.realpath(sys.executable).lower()
|
||||
'''
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test(tmp_path):
|
||||
project_dir = tmp_path / 'project'
|
||||
project_dir = tmp_path / "project"
|
||||
project_with_before_build_asserts.generate(project_dir)
|
||||
|
||||
before_build = (
|
||||
'''python -c "import sys; open('{output_dir}pythonversion.txt', 'w').write(sys.version)" && '''
|
||||
"""python -c "import sys; open('{output_dir}pythonversion.txt', 'w').write(sys.version)" && """
|
||||
'''python -c "import sys; open('{output_dir}pythonexecutable.txt', 'w').write(sys.executable)"'''
|
||||
)
|
||||
|
||||
@@ -47,41 +47,41 @@ def test(tmp_path):
|
||||
add_env={
|
||||
# write python version information to a temporary file, this is
|
||||
# checked in setup.py
|
||||
'CIBW_BEFORE_BUILD': before_build.format(output_dir='/tmp/'),
|
||||
'CIBW_BEFORE_BUILD_WINDOWS': before_build.format(output_dir=r'c:\\'),
|
||||
"CIBW_BEFORE_BUILD": before_build.format(output_dir="/tmp/"),
|
||||
"CIBW_BEFORE_BUILD_WINDOWS": before_build.format(output_dir=r"c:\\"),
|
||||
},
|
||||
)
|
||||
|
||||
# also check that we got the right wheels
|
||||
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_failing_command(tmp_path):
|
||||
project_dir = tmp_path / 'project'
|
||||
project_dir = tmp_path / "project"
|
||||
test_projects.new_c_project().generate(project_dir)
|
||||
|
||||
with pytest.raises(subprocess.CalledProcessError):
|
||||
utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
add_env={
|
||||
'CIBW_BEFORE_BUILD': 'false',
|
||||
'CIBW_BEFORE_BUILD_WINDOWS': 'exit /b 1',
|
||||
"CIBW_BEFORE_BUILD": "false",
|
||||
"CIBW_BEFORE_BUILD_WINDOWS": "exit /b 1",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_cwd(tmp_path):
|
||||
project_dir = tmp_path / 'project'
|
||||
project_dir = tmp_path / "project"
|
||||
test_projects.new_c_project().generate(project_dir)
|
||||
|
||||
actual_wheels = utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
add_env={
|
||||
'CIBW_BEFORE_BUILD': f'''python -c "import os; assert os.getcwd() == {str(project_dir)!r}"''',
|
||||
'CIBW_BEFORE_BUILD_LINUX': '''python -c "import os; assert os.getcwd() == '/project'"''',
|
||||
"CIBW_BEFORE_BUILD": f'''python -c "import os; assert os.getcwd() == {str(project_dir)!r}"''',
|
||||
"CIBW_BEFORE_BUILD_LINUX": '''python -c "import os; assert os.getcwd() == '/project'"''',
|
||||
},
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user