Added support for CIBW_TEST_EXTRAS to allow extras_require to be used to install test dependencies
This commit is contained in:
@@ -225,6 +225,7 @@ All being well, you should get wheels delivered to you in a few minutes.
|
|||||||
| | `CIBW_MANYLINUX1_I686_IMAGE` | Specify an alternative manylinux1 i686 docker image |
|
| | `CIBW_MANYLINUX1_I686_IMAGE` | Specify an alternative manylinux1 i686 docker image |
|
||||||
| **Tests** | `CIBW_TEST_COMMAND` | Execute a shell command to test all built wheels |
|
| **Tests** | `CIBW_TEST_COMMAND` | Execute a shell command to test all built wheels |
|
||||||
| | `CIBW_TEST_REQUIRES` | Install Python dependencies before running the tests |
|
| | `CIBW_TEST_REQUIRES` | Install Python dependencies before running the tests |
|
||||||
|
| | `CIBW_TEST_EXTRAS` | Install Python dependencies before running the tests using ``extras_require``|
|
||||||
|
|
||||||
A more detailed description of the options, the allowed values, and some examples can be found in the [Options](#options) section.
|
A more detailed description of the options, the allowed values, and some examples can be found in the [Options](#options) section.
|
||||||
|
|
||||||
@@ -412,6 +413,25 @@ Example: `nose==1.3.7 moto==0.4.31`
|
|||||||
Platform-specific variants also available:
|
Platform-specific variants also available:
|
||||||
`CIBW_TEST_REQUIRES_MACOS` | `CIBW_TEST_REQUIRES_WINDOWS` | `CIBW_TEST_REQUIRES_LINUX`
|
`CIBW_TEST_REQUIRES_MACOS` | `CIBW_TEST_REQUIRES_WINDOWS` | `CIBW_TEST_REQUIRES_LINUX`
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
| Environment variable: `CIBW_TEST_EXTRAS`
|
||||||
|
| ---
|
||||||
|
|
||||||
|
Optional.
|
||||||
|
|
||||||
|
Comma-separated list of
|
||||||
|
[extras_require](https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies)
|
||||||
|
options that should be included when installing the wheel prior to running the
|
||||||
|
tests. This can be used to avoid having to redefine test dependencies in
|
||||||
|
``CIBW_TEST_REQUIRES`` if they are already defined in ``setup.py`` or
|
||||||
|
``setup.cfg``.
|
||||||
|
|
||||||
|
Example: `test,qt` (will cause the wheel to be installed with ``pip install <wheel_file>[test,qt])
|
||||||
|
|
||||||
|
|
||||||
|
Platform-specific variants also available:
|
||||||
|
`CIBW_TEST_EXTRAS_MACOS` | `CIBW_TEST_EXTRAS_WINDOWS` | `CIBW_TEST_EXTRAS_LINUX`
|
||||||
|
|
||||||
### Example YML syntax
|
### Example YML syntax
|
||||||
|
|
||||||
|
|||||||
@@ -91,12 +91,16 @@ def main():
|
|||||||
output_dir = args.output_dir
|
output_dir = args.output_dir
|
||||||
test_command = get_option_from_environment('CIBW_TEST_COMMAND', platform=platform)
|
test_command = get_option_from_environment('CIBW_TEST_COMMAND', platform=platform)
|
||||||
test_requires = get_option_from_environment('CIBW_TEST_REQUIRES', platform=platform, default='').split()
|
test_requires = get_option_from_environment('CIBW_TEST_REQUIRES', platform=platform, default='').split()
|
||||||
|
test_extras = get_option_from_environment('CIBW_TEST_EXTRAS', platform=platform, default='')
|
||||||
project_dir = args.project_dir
|
project_dir = args.project_dir
|
||||||
before_build = get_option_from_environment('CIBW_BEFORE_BUILD', platform=platform)
|
before_build = get_option_from_environment('CIBW_BEFORE_BUILD', platform=platform)
|
||||||
build_verbosity = get_option_from_environment('CIBW_BUILD_VERBOSITY', platform=platform, default='')
|
build_verbosity = get_option_from_environment('CIBW_BUILD_VERBOSITY', platform=platform, default='')
|
||||||
build_config, skip_config = os.environ.get('CIBW_BUILD', '*'), os.environ.get('CIBW_SKIP', '')
|
build_config, skip_config = os.environ.get('CIBW_BUILD', '*'), os.environ.get('CIBW_SKIP', '')
|
||||||
environment_config = get_option_from_environment('CIBW_ENVIRONMENT', platform=platform, default='')
|
environment_config = get_option_from_environment('CIBW_ENVIRONMENT', platform=platform, default='')
|
||||||
|
|
||||||
|
if test_extras:
|
||||||
|
test_extras = '[{0}]'.format(test_extras)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
build_verbosity = min(3, max(-3, int(build_verbosity)))
|
build_verbosity = min(3, max(-3, int(build_verbosity)))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@@ -129,6 +133,7 @@ def main():
|
|||||||
output_dir=output_dir,
|
output_dir=output_dir,
|
||||||
test_command=test_command,
|
test_command=test_command,
|
||||||
test_requires=test_requires,
|
test_requires=test_requires,
|
||||||
|
test_extras=test_extras,
|
||||||
before_build=before_build,
|
before_build=before_build,
|
||||||
build_verbosity=build_verbosity,
|
build_verbosity=build_verbosity,
|
||||||
build_selector=build_selector,
|
build_selector=build_selector,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def get_python_configurations(build_selector):
|
|||||||
return [c for c in python_configurations if build_selector(c.identifier)]
|
return [c for c in python_configurations if build_selector(c.identifier)]
|
||||||
|
|
||||||
|
|
||||||
def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment, manylinux1_images):
|
def build(project_dir, output_dir, test_command, test_requires, test_extras, before_build, build_verbosity, build_selector, environment, manylinux1_images):
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(['docker', '--version'])
|
subprocess.check_call(['docker', '--version'])
|
||||||
except:
|
except:
|
||||||
@@ -86,7 +86,7 @@ def build(project_dir, output_dir, test_command, test_requires, before_build, bu
|
|||||||
delocated_wheel=(/tmp/delocated_wheel/*.whl)
|
delocated_wheel=(/tmp/delocated_wheel/*.whl)
|
||||||
|
|
||||||
# Install the wheel we just built
|
# Install the wheel we just built
|
||||||
"$PYBIN/pip" install "$delocated_wheel"
|
"$PYBIN/pip" install "$delocated_wheel"{test_extras}
|
||||||
|
|
||||||
# Install any requirements to run the tests
|
# Install any requirements to run the tests
|
||||||
if [ ! -z "{test_requires}" ]; then
|
if [ ! -z "{test_requires}" ]; then
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ def get_python_configurations(build_selector):
|
|||||||
return [c for c in python_configurations if build_selector(c.identifier)]
|
return [c for c in python_configurations if build_selector(c.identifier)]
|
||||||
|
|
||||||
|
|
||||||
def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment):
|
def build(project_dir, output_dir, test_command, test_requires, test_extras, before_build, build_verbosity, build_selector, environment):
|
||||||
python_configurations = get_python_configurations(build_selector)
|
python_configurations = get_python_configurations(build_selector)
|
||||||
get_pip_url = 'https://bootstrap.pypa.io/get-pip.py'
|
get_pip_url = 'https://bootstrap.pypa.io/get-pip.py'
|
||||||
get_pip_script = '/tmp/get-pip.py'
|
get_pip_script = '/tmp/get-pip.py'
|
||||||
@@ -121,7 +121,7 @@ def build(project_dir, output_dir, test_command, test_requires, before_build, bu
|
|||||||
delocated_wheel = glob('/tmp/delocated_wheel/*.whl')[0]
|
delocated_wheel = glob('/tmp/delocated_wheel/*.whl')[0]
|
||||||
|
|
||||||
# install the wheel
|
# install the wheel
|
||||||
call(['pip', 'install', delocated_wheel], env=env)
|
call(['pip', 'install', delocated_wheel + test_extras], env=env)
|
||||||
|
|
||||||
# test the wheel
|
# test the wheel
|
||||||
if test_requires:
|
if test_requires:
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ def get_python_configurations(build_selector):
|
|||||||
return [c for c in python_configurations if build_selector(c.identifier)]
|
return [c for c in python_configurations if build_selector(c.identifier)]
|
||||||
|
|
||||||
|
|
||||||
def build(project_dir, output_dir, test_command, test_requires, before_build, build_verbosity, build_selector, environment):
|
def build(project_dir, output_dir, test_command, test_requires, test_extras, before_build, build_verbosity, build_selector, environment):
|
||||||
if IS_RUNNING_ON_AZURE:
|
if IS_RUNNING_ON_AZURE:
|
||||||
def shell(args, env=None, cwd=None):
|
def shell(args, env=None, cwd=None):
|
||||||
print('+ ' + ' '.join(args))
|
print('+ ' + ' '.join(args))
|
||||||
@@ -122,7 +122,7 @@ def build(project_dir, output_dir, test_command, test_requires, before_build, bu
|
|||||||
built_wheel = glob(built_wheel_dir+'/*.whl')[0]
|
built_wheel = glob(built_wheel_dir+'/*.whl')[0]
|
||||||
|
|
||||||
# install the wheel
|
# install the wheel
|
||||||
shell(['pip', 'install', built_wheel], env=env)
|
shell(['pip', 'install', built_wheel + test_extras], env=env)
|
||||||
|
|
||||||
# test the wheel
|
# test the wheel
|
||||||
if test_requires:
|
if test_requires:
|
||||||
|
|||||||
Reference in New Issue
Block a user