-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework tests to isolate the currently reused wheelhouse directory
utils is now a fixture providing tmp_path to run cibuildwheel
- Loading branch information
Showing
10 changed files
with
180 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import os | ||
import utils | ||
from utils import utils | ||
|
||
|
||
project_dir = os.path.dirname(__file__) | ||
PROJECT_DIR = os.path.dirname(__file__) | ||
|
||
def test(): | ||
|
||
def test(utils): | ||
# build the wheels | ||
utils.cibuildwheel_run(project_dir) | ||
utils.cibuildwheel_run(PROJECT_DIR) | ||
|
||
# check that the expected wheels are produced | ||
expected_wheels = utils.expected_wheels('spam', '0.1.0') | ||
actual_wheels = os.listdir('wheelhouse') | ||
actual_wheels = utils.list_wheels() | ||
assert set(actual_wheels) == set(expected_wheels) | ||
|
||
|
||
def test_build_identifiers(): | ||
def test_build_identifiers(utils): | ||
# check that the number of expected wheels matches the number of build | ||
# identifiers | ||
# 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] | ||
build_identifiers = utils.cibuildwheel_get_build_identifiers(project_dir) | ||
build_identifiers = utils.cibuildwheel_get_build_identifiers(PROJECT_DIR) | ||
assert len(expected_wheels) == len(build_identifiers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
import os | ||
import utils | ||
from utils import utils | ||
|
||
def test(): | ||
project_dir = os.path.dirname(__file__) | ||
|
||
PROJECT_DIR = os.path.dirname(__file__) | ||
|
||
|
||
def test(utils): | ||
# build the wheels | ||
utils.cibuildwheel_run(project_dir, add_env={ | ||
utils.cibuildwheel_run(PROJECT_DIR, add_env={ | ||
# write python version information to a temporary file, this is | ||
# checked in setup.py | ||
'CIBW_BEFORE_BUILD': '''python -c "import sys; open('/tmp/pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('/tmp/pythonexecutable.txt', 'w').write(sys.executable)"''', | ||
'CIBW_BEFORE_BUILD_WINDOWS': '''python -c "import sys; open('c:\\pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('c:\\pythonexecutable.txt', 'w').write(sys.executable)"''', | ||
}) | ||
|
||
# also check that we got the right wheels | ||
expected_wheels = utils.expected_wheels('spam', '0.1.0') | ||
actual_wheels = os.listdir('wheelhouse') | ||
actual_wheels = utils.list_wheels() | ||
assert set(actual_wheels) == set(expected_wheels) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import os | ||
import utils | ||
from utils import utils | ||
|
||
def test(): | ||
project_dir = os.path.dirname(__file__) | ||
|
||
PROJECT_DIR = os.path.dirname(__file__) | ||
|
||
|
||
def test(utils): | ||
# build the wheels | ||
utils.cibuildwheel_run(project_dir, add_env={ | ||
utils.cibuildwheel_run(PROJECT_DIR, add_env={ | ||
'CIBW_BUILD': 'cp3?-*', | ||
'CIBW_SKIP': 'cp37-*', | ||
}) | ||
|
||
# check that we got the right wheels. There should be no 2.7 or 3.7. | ||
expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') | ||
if ('-cp3' in w) and ('-cp37' not in w)] | ||
actual_wheels = os.listdir('wheelhouse') | ||
actual_wheels = utils.list_wheels() | ||
assert set(actual_wheels) == set(expected_wheels) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
import os | ||
import utils | ||
from utils import utils | ||
|
||
def test(): | ||
project_dir = os.path.dirname(__file__) | ||
|
||
PROJECT_DIR = os.path.dirname(__file__) | ||
|
||
|
||
def test(utils): | ||
# write some information into the CIBW_ENVIRONMENT, for expansion and | ||
# insertion into the environment by cibuildwheel. This is checked | ||
# in setup.py | ||
utils.cibuildwheel_run(project_dir, add_env={ | ||
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"''', | ||
}) | ||
|
||
# also check that we got the right wheels built | ||
expected_wheels = utils.expected_wheels('spam', '0.1.0') | ||
actual_wheels = os.listdir('wheelhouse') | ||
actual_wheels = utils.list_wheels() | ||
assert set(actual_wheels) == set(expected_wheels) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import os | ||
import utils | ||
from utils import utils | ||
|
||
def test(): | ||
project_dir = os.path.dirname(__file__) | ||
|
||
PROJECT_DIR = os.path.dirname(__file__) | ||
|
||
|
||
def test(utils): | ||
# this test checks that SSL is working in the build environment using | ||
# some checks in setup.py. | ||
|
||
utils.cibuildwheel_run(project_dir) | ||
utils.cibuildwheel_run(PROJECT_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import os, pytest | ||
import utils | ||
from utils import utils | ||
|
||
def test(): | ||
project_dir = os.path.dirname(__file__) | ||
|
||
PROJECT_DIR = os.path.dirname(__file__) | ||
|
||
|
||
def test(utils): | ||
if utils.platform != 'linux': | ||
pytest.skip('the docker test is only relevant to the linux build') | ||
|
||
# build the wheels | ||
# CFLAGS environment veriable is ecessary to fail on 'malloc_info' (on manylinux1) during compilation/linking, | ||
# rather than when dynamically loading the Python | ||
utils.cibuildwheel_run(project_dir, add_env={ | ||
# rather than when dynamically loading the Python | ||
utils.cibuildwheel_run(PROJECT_DIR, add_env={ | ||
'CIBW_ENVIRONMENT': 'CFLAGS="$CFLAGS -Werror=implicit-function-declaration"', | ||
}) | ||
|
||
# also check that we got the right wheels | ||
expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') | ||
if not '-manylinux' in w or '-manylinux2010' in w] | ||
actual_wheels = os.listdir('wheelhouse') | ||
actual_wheels = utils.list_wheels() | ||
assert set(actual_wheels) == set(expected_wheels) |
Oops, something went wrong.