diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9e4eea1b2..86fbc5326 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,7 @@ jobs: name: Test cibuildwheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-18.04, windows-latest, macos-latest] python_version: ['3.7'] diff --git a/bin/run_tests.py b/bin/run_tests.py index 17f06aa55..98d46585a 100755 --- a/bin/run_tests.py +++ b/bin/run_tests.py @@ -17,4 +17,4 @@ subprocess.check_call(unit_test_args) # run the integration tests - subprocess.check_call([sys.executable, '-m', 'pytest', '-x', '--durations', '0', 'test']) + subprocess.check_call([sys.executable, '-m', 'pytest', '-x', '--durations', '0', 'test', '-n', '2', '--dist=loadfile']) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 9eb8c9e99..8ed900593 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -17,6 +17,8 @@ IS_RUNNING_ON_AZURE = Path('C:\\hostedtoolcache').exists() IS_RUNNING_ON_TRAVIS = os.environ.get('TRAVIS_OS_NAME') == 'windows' +INSTALL_PATH = 'C:\\cibw' + def call(args: Sequence[Union[str, PathLike]], env: Optional[Dict[str, str]] = None, cwd: Optional[str] = None) -> None: @@ -35,7 +37,7 @@ def get_nuget_args(version: str, arch: str) -> List[str]: python_name = 'python' if version[0] == '3' else 'python2' if arch == '32': python_name = python_name + 'x86' - return [python_name, '-Version', version, '-OutputDirectory', 'C:\\cibw\\python'] + return [python_name, '-Version', version, '-OutputDirectory', INSTALL_PATH + '\\python'] class PythonConfiguration(NamedTuple): @@ -84,7 +86,8 @@ def extract_zip(zip_src: Path, dest: Path) -> None: def install_cpython(version: str, arch: str, nuget: Path) -> Path: nuget_args = get_nuget_args(version, arch) installation_path = Path(nuget_args[-1]) / (nuget_args[0] + '.' + version) / 'tools' - call([nuget, 'install', *nuget_args]) + if not installation_path.exists(): + call([nuget, 'install', *nuget_args]) return installation_path @@ -94,9 +97,9 @@ def install_pypy(version: str, arch: str, url: str) -> Path: zip_filename = url.rsplit('/', 1)[-1] extension = ".zip" assert zip_filename.endswith(extension) - installation_path = Path('C:\\cibw') / zip_filename[:-len(extension)] + installation_path = Path(INSTALL_PATH) / zip_filename[:-len(extension)] if not installation_path.exists(): - pypy_zip = Path('C:\\cibw') / zip_filename + pypy_zip = Path(INSTALL_PATH) / zip_filename download(url, pypy_zip) # Extract to the parent directory because the zip file still contains a directory extract_zip(pypy_zip, installation_path.parent) @@ -106,7 +109,7 @@ def install_pypy(version: str, arch: str, url: str) -> Path: def setup_python(python_configuration: PythonConfiguration, dependency_constraint_flags: Sequence[Union[str, PathLike]], environment: ParsedEnvironment) -> Dict[str, str]: - nuget = Path('C:\\cibw\\nuget.exe') + nuget = Path(INSTALL_PATH + '\\nuget.exe') if not nuget.exists(): download('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', nuget) @@ -143,7 +146,7 @@ def setup_python(python_configuration: PythonConfiguration, dependency_constrain # make sure pip is installed if not (installation_path / 'Scripts' / 'pip.exe').exists(): - call(['python', get_pip_script, *dependency_constraint_flags], env=env, cwd="C:\\cibw") + call(['python', get_pip_script, *dependency_constraint_flags], env=env, cwd=INSTALL_PATH) assert (installation_path / 'Scripts' / 'pip.exe').exists() where_pip = subprocess.check_output(['where', 'pip'], env=env, universal_newlines=True).splitlines()[0].strip() if where_pip.strip() != str(installation_path / 'Scripts' / 'pip.exe'): @@ -195,7 +198,7 @@ def build(options: BuildOptions) -> None: repaired_wheel_dir = temp_dir / 'repaired_wheel' # install nuget as best way to provide python - nuget = Path('C:\\cibw\\nuget.exe') + nuget = Path(INSTALL_PATH + '\\nuget.exe') download('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', nuget) if options.before_all: diff --git a/requirements-dev.txt b/requirements-dev.txt index e61296843..03f29a4eb 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,7 @@ -e . -e ./docs/mkdocs_include_markdown_plugin pytest +pytest-xdist mkdocs==1.0.4 pymdown-extensions pip-tools diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 000000000..671121e5c --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,13 @@ +import pytest + +import cibuildwheel.windows + + +@pytest.fixture(autouse=True) +def setup_python(monkeypatch, request): + try: + from xdist.plugin import get_xdist_worker_id + worker_id = get_xdist_worker_id(request) + monkeypatch.setattr(cibuildwheel.windows, "INSTALL_PATH", 'C:\\cibw\\{}'.format(worker_id)) + except ImportError: + pass