From d613a8c1a63525a5e58ec2c3b190995359d067f7 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Mon, 20 Jan 2020 00:03:28 +0100 Subject: [PATCH] remove clean files from setup.py, fixes in doc --- docs/options.md | 12 ++++++------ test/10_before_test/setup.py | 10 ---------- test/10_before_test/test/spam_test.py | 3 ++- unit_test/main_options_test.py | 2 +- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/docs/options.md b/docs/options.md index dff21fe4..b1d64042 100644 --- a/docs/options.md +++ b/docs/options.md @@ -343,8 +343,8 @@ CIBW_TEST_EXTRAS: test,qt ### `CIBW_BEFORE_TEST` {: #before-test} > Execute a shell command before testing each wheel -A shell command to run in **each** test virtual environment, before your wheel is installed and tested. This is useful if you need to install non pip package, change values of environment variables -or perform multi step pip installation (like install `scikit-build` or `cython` before install test package) +A shell command to run in **each** test virtual environment, before your wheel is installed and tested. This is useful if you need to install a non pip package, change values of environment variables +or perform multi step pip installation (e.g. installing `scikit-build` or `cython` before install test package) The active Python binary can be accessed using `python`, and pip with `pip`; `cibuildwheel` makes sure the right version of Python and pip will be executed. `{project}` can be used as a placeholder for the absolute path to the project's root and will be replaced by `cibuildwheel`. @@ -356,14 +356,14 @@ Platform-specific variants also available:
#### Examples ```yaml -# install packages needed to build test dependencies -CIBW_BEFORE_TEST: pip install cmake scikit-build - # install test dependencies with overwritten environment variables. CIBW_BEFORE_TEST: CC=gcc CXX=g++ pip install -r requirements.txt # chain commands using && -CIBW_BEFORE_TEST: yum install -y libffi-dev && pip install . +CIBW_BEFORE_TEST : rm -rf ./data/cache && mkdir -p ./data/cache + +# install python packages that are required to install test dependencies +CIBW_BEFORE_TEST: pip install cmake scikit-build ``` ## Other diff --git a/test/10_before_test/setup.py b/test/10_before_test/setup.py index 8abc7921..7bdeac0b 100644 --- a/test/10_before_test/setup.py +++ b/test/10_before_test/setup.py @@ -1,16 +1,6 @@ from setuptools import setup, Extension import sys, os -# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step -# is the same one as is currently running. -version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt' -if os.path.exists(version_file): - os.remove(version_file) - -# check that the executable also was written -executable_file = 'c:\\pythonexecutable.txt' if sys.platform == 'win32' else '/tmp/pythonexecutable.txt' -if os.path.exists(executable_file): - os.remove(executable_file) setup( name="spam", diff --git a/test/10_before_test/test/spam_test.py b/test/10_before_test/test/spam_test.py index 7560b438..f5d9d605 100644 --- a/test/10_before_test/test/spam_test.py +++ b/test/10_before_test/test/spam_test.py @@ -4,8 +4,9 @@ from unittest import TestCase class TestBeforeTest(TestCase): def test_version(self): - # assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step + # assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_TEST step # is the same one as is currently running. + # because of use symlinks in MacOS run this test is also need version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt' with open(version_file) as f: stored_version = f.read() diff --git a/unit_test/main_options_test.py b/unit_test/main_options_test.py index 99387bf5..73545d61 100644 --- a/unit_test/main_options_test.py +++ b/unit_test/main_options_test.py @@ -218,4 +218,4 @@ def test_before_test(before_test, platform_specific, platform, intercepted_build main() - assert intercepted_build_args.kwargs['before_test'] == before_test \ No newline at end of file + assert intercepted_build_args.kwargs['before_test'] == before_test