As discussed in code review

This commit is contained in:
Joe Rickerby
2020-05-15 12:19:38 +01:00
parent 71150a1cb5
commit 0411fcc2ae
7 changed files with 28 additions and 22 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/bash
CIBW_PLATFORM=linux pytest $1
CIBW_PLATFORM=linux pytest "$@"
+1 -1
View File
@@ -12,4 +12,4 @@ if __name__ == '__main__':
subprocess.check_call([sys.executable, '-m', 'pytest', 'unit_test'])
# run the integration tests
subprocess.check_call([sys.executable, '-m', 'pytest', '--durations', '0', 'test'])
subprocess.check_call([sys.executable, '-m', 'pytest', '-x', '--durations', '0', 'test'])
+1 -1
View File
@@ -21,7 +21,7 @@ class TemplateProject:
file_path = os.path.join(path, filename)
os.makedirs(os.path.dirname(file_path), exist_ok=True)
with io.open(file_path, 'w', encoding='utf8') as f:
with open(file_path, 'w', encoding='utf8') as f:
if isinstance(content, jinja2.Template):
content = content.render(self.template_context)
+1 -1
View File
@@ -21,7 +21,7 @@ def test(tmp_path):
actual_wheels = utils.cibuildwheel_run(project_dir)
# check that the expected wheels are produced
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)
+19 -16
View File
@@ -72,15 +72,18 @@ MOD_INIT(spam)
''')
cpp11_project = cpp_template_project.copy()
cpp11_project.template_context['extra_compile_args'] = (
['/std:c++11'] if utils.platform == 'windows' else ['-std=c++11']
)
cpp11_project.template_context['spam_cpp_top_level_add'] = '#include <array>'
def test_cpp11(tmp_path):
# This test checks that the C++11 standard is supported
project_dir = tmp_path / 'project'
project = cpp_template_project.copy()
extra_compile_args = ['/std:c++11'] if utils.platform == 'windows' else ['-std=c++11']
project.template_context['extra_compile_args'] = extra_compile_args
project.template_context['spam_cpp_top_level_add'] = '#include <array>'
project.generate(project_dir)
cpp11_project.generate(project_dir)
# VC++ for Python 2.7 does not support modern standards
add_env = {'CIBW_SKIP': 'cp27-win* pp27-win32'}
@@ -92,15 +95,18 @@ def test_cpp11(tmp_path):
assert set(actual_wheels) == set(expected_wheels)
cpp14_project = cpp_template_project.copy()
cpp14_project.template_context['extra_compile_args'] = (
['/std:c++14'] if utils.platform == 'windows' else ['-std=c++14']
)
cpp14_project.template_context['spam_cpp_top_level_add'] = "int a = 100'000;"
def test_cpp14(tmp_path):
# This test checks that the C++14 standard is supported
project_dir = tmp_path / 'project'
project = cpp_template_project.copy()
extra_compile_args = ['/std:c++14'] if utils.platform == 'windows' else ['-std=c++14']
project.template_context['extra_compile_args'] = extra_compile_args
project.template_context['spam_cpp_top_level_add'] = "int a = 100'000;"
project.generate(project_dir)
cpp14_project.generate(project_dir)
# VC++ for Python 2.7 does not support modern standards
# The manylinux1 docker image does not have a compiler which supports C++11
@@ -115,12 +121,9 @@ def test_cpp14(tmp_path):
cpp17_project = cpp_template_project.copy()
if utils.platform == 'windows':
cpp17_project.template_context['extra_compile_args'] = ['/std:c++17', '/wd5033']
else:
cpp17_project.template_context['extra_compile_args'] = ['-std=c++17', '-Wno-register']
cpp17_project.template_context['extra_compile_args'] = (
['/std:c++17', '/wd5033'] if utils.platform == 'windows' else ['-std=c++17', '-Wno-register']
)
cpp17_project.template_context['spam_cpp_top_level_add'] = r'''
#include <utility>
auto a = std::pair(5.0, false);
+4 -1
View File
@@ -28,4 +28,7 @@ def test(tmp_path):
project_dir = tmp_path / 'project'
project_with_ssl_tests.generate(project_dir)
utils.cibuildwheel_run(project_dir)
actual_wheels = utils.cibuildwheel_run(project_dir)
expected_wheels = utils.expected_wheels('spam', '0.1.0')
assert set(actual_wheels) == set(expected_wheels)
+1 -1
View File
@@ -33,7 +33,7 @@ def cibuildwheel_get_build_identifiers(project_path, env=None):
for the current platform.
'''
cmd_output = subprocess.check_output(
[sys.executable, '-m', 'cibuildwheel', '--print-build-identifiers', str(project_path)],
[sys.executable, '-m', 'cibuildwheel', '--print-build-identifiers', project_path],
universal_newlines=True,
env=env,
)