diff --git a/test/README.md b/test/README.md index d95aacea..5f34f5e9 100644 --- a/test/README.md +++ b/test/README.md @@ -1,3 +1 @@ -This folder contains repos that are built by cibuildwheel to test cibuildwheel. Confusing, I know. - -Basically, if cibuildwheel can build these projects, we're good. +This folder contains integration tests for cibuildwheel. diff --git a/test/template_projects/base.py b/test/template_projects/base.py index 7882e73a..81cf9afd 100644 --- a/test/template_projects/base.py +++ b/test/template_projects/base.py @@ -1,7 +1,7 @@ import os import io import jinja2 -from typing import Union, Dict, Any, Optional +from typing import Union, Dict, Any FilesDict = Dict[str, Union[str, jinja2.Template]] diff --git a/test/test_01_basic.py b/test/test_01_basic.py index 600e3416..de663848 100644 --- a/test/test_01_basic.py +++ b/test/test_01_basic.py @@ -1,5 +1,5 @@ -import os import textwrap +import platform from .template_projects import CTemplateProject from . import utils @@ -12,6 +12,7 @@ basic_project = CTemplateProject( ''') ) + def test(tmpdir): project_dir = str(tmpdir) basic_project.generate(project_dir) @@ -33,10 +34,10 @@ def test_build_identifiers(tmpdir): # after adding CIBW_MANYLINUX_IMAGE to support manylinux2010, there # can be multiple wheels for each wheel, though, so we need to limit # the expected wheels - expected_wheels = [ - w - for w in utils.expected_wheels("spam", "0.1.0") - if not "-manylinux" in w or "-manylinux1" in w - ] + if platform.machine() in ['x86_64', 'i686']: + expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') + if '-manylinux' not in w or '-manylinux1' in w] + else: + expected_wheels = utils.expected_wheels('spam', '0.1.0') build_identifiers = utils.cibuildwheel_get_build_identifiers(project_dir) assert len(expected_wheels) == len(build_identifiers) diff --git a/test/test_02_testing.py b/test/test_02_testing.py index 369f1505..37f1009f 100644 --- a/test/test_02_testing.py +++ b/test/test_02_testing.py @@ -1,5 +1,9 @@ -import os, subprocess -import pytest, textwrap +import os +import subprocess +import textwrap + +import pytest + from . import utils from .template_projects import CTemplateProject @@ -39,7 +43,6 @@ def test(tmpdir): assert set(actual_wheels) == set(expected_wheels) - def test_extras_require(tmpdir): project_dir = str(tmpdir) project_with_a_test.generate(project_dir) @@ -74,4 +77,3 @@ def test_failing_test(tmp_path): }) assert len(os.listdir(output_dir)) == 0 - diff --git a/test/test_03_before_build.py b/test/test_03_before_build.py index 58e51b2d..db81bb6b 100644 --- a/test/test_03_before_build.py +++ b/test/test_03_before_build.py @@ -1,8 +1,8 @@ -import os, textwrap +import textwrap + from . import utils from .template_projects import CTemplateProject - project_with_before_build_asserts = CTemplateProject( setup_py_add=textwrap.dedent(r''' import sys, os diff --git a/test/test_04_build_skip.py b/test/test_04_build_skip.py index 73f0de52..f6cb123a 100644 --- a/test/test_04_build_skip.py +++ b/test/test_04_build_skip.py @@ -1,8 +1,8 @@ -import os, textwrap +import textwrap + from . import utils from .template_projects import CTemplateProject - project_with_skip_asserts = CTemplateProject( setup_py_add=textwrap.dedent(r''' # explode if run on Python 2.7 or Python 3.7 (these should be skipped) @@ -13,6 +13,7 @@ project_with_skip_asserts = CTemplateProject( ''') ) + def test(tmpdir): project_dir = str(tmpdir) project_with_skip_asserts.generate(project_dir) diff --git a/test/test_06_docker_images.py b/test/test_06_docker_images.py index 5a0af5ce..c0254408 100644 --- a/test/test_06_docker_images.py +++ b/test/test_06_docker_images.py @@ -1,8 +1,11 @@ -import os, pytest, textwrap +import platform +import textwrap + +import pytest + from . import utils from .template_projects import CTemplateProject - dockcross_only_project = CTemplateProject( setup_py_add=textwrap.dedent(r''' import os, sys @@ -16,6 +19,7 @@ dockcross_only_project = CTemplateProject( ''') ) + def test(tmpdir): if utils.platform != 'linux': pytest.skip('the test is only relevant to the linux build') diff --git a/test/test_07_ssl.py b/test/test_07_ssl.py index 18440d3e..ae42fe77 100644 --- a/test/test_07_ssl.py +++ b/test/test_07_ssl.py @@ -1,8 +1,8 @@ -import os, textwrap +import textwrap + from . import utils from .template_projects import CTemplateProject - project_with_ssl_tests = CTemplateProject( setup_py_add=textwrap.dedent(r''' import ssl @@ -21,6 +21,7 @@ project_with_ssl_tests = CTemplateProject( ''') ) + def test(tmpdir): # this test checks that SSL is working in the build environment using # some checks in setup.py. diff --git a/test/test_08_manylinuxXXXX_only.py b/test/test_08_manylinuxXXXX_only.py index 07db23eb..25aa6255 100644 --- a/test/test_08_manylinuxXXXX_only.py +++ b/test/test_08_manylinuxXXXX_only.py @@ -1,4 +1,8 @@ -import os, pytest, textwrap, platform +import platform +import textwrap + +import pytest + from . import utils from .template_projects import CTemplateProject diff --git a/test/test_09_cpp_standards.py b/test/test_09_cpp_standards.py index dcf39f72..108775b7 100644 --- a/test/test_09_cpp_standards.py +++ b/test/test_09_cpp_standards.py @@ -1,15 +1,16 @@ import os import textwrap +import jinja2 import pytest from . import utils from .template_projects import SetuptoolsTemplateProject -import jinja2 cpp_project = SetuptoolsTemplateProject( setup_py_add='''ext_modules=[Extension('spam', sources=['spam.cpp'])],''' ) + cpp_project.files['spam.cpp'] = jinja2.Template(r''' #include @@ -63,7 +64,6 @@ MOD_INIT(spam) } ''') -project_dir = os.path.dirname(__file__) def test_cpp11(tmpdir): # This test checks that the C++11 standard is supported diff --git a/test/test_10_before_test.py b/test/test_10_before_test.py index 1573fc84..46b3dce3 100644 --- a/test/test_10_before_test.py +++ b/test/test_10_before_test.py @@ -1,6 +1,5 @@ -import os +from .template_projects.c import CTemplateProject from . import utils -from test.template_projects.c import CTemplateProject before_test_project = CTemplateProject() before_test_project.files['test/spam_test.py'] = r''' @@ -34,6 +33,7 @@ class TestBeforeTest(TestCase): assert os.stat(stored_prefix) == os.stat(sys.prefix) ''' + def test(tmpdir): project_dir = str(tmpdir) before_test_project.generate(project_dir)