diff --git a/appveyor.yml b/appveyor.yml index 281be915..c67a8cfb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,24 +1,40 @@ build: off version: 1.0.{build} - skip_branch_with_pr: true init: +- ps: >- + + git config --global core.sharedRepository true + + git config --global core.longpaths true + + git config --global core.autocrlf input + + if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + Write-Host "There are newer queued builds for this pull request, skipping build." + Exit-AppveyorBuild + } + + If (($env:SKIP_NOTAG -eq "true") -and ($env:APPVEYOR_REPO_TAG -ne "true")) { + Write-Host "Skipping build, not at a tag." + Exit-AppveyorBuild + } - - git config --global core.sharedRepository true - - git config --global core.longpaths true - - git config --global core.autocrlf input environment: PYPI_VENDOR_DIR: '.\tests\pypi\' GIT_ASK_YESNO: 'false' + APPVEYOR_SAVE_CACHE_ON_ERROR: 'true' + APPVEYOR_SKIP_FINALIZE_ON_EXIT: 'true' SHELL: 'windows' PYTHON_ARCH: '64' PYTHONIOENCODING: 'utf-8' matrix: - - PYTHON: 'C:\Python27-x64' PYTHON_VERSION: '2.7.x' TEST_SUITE: 'not install' @@ -39,19 +55,60 @@ environment: PYTEST_ADDOPTS: '--cache-clear' RUN_INTEGRATION_TESTS: 'True' + - PYTHON: 'C:\Python37-x64' + PYTHON_VERSION: '3.7.x' + TEST_SUITE: 'not install' + + - PYTHON: 'C:\Python37-x64' + PYTHON_VERSION: '3.7.x' + TEST_SUITE: 'install' + PYTEST_ADDOPTS: '--cache-clear' + RUN_INTEGRATION_TESTS: 'True' + install: - - 'set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%' - - '%PYTHON%\python.exe -m pip install --upgrade pip' - - '%PYTHON%\python.exe -m pip install -e .' - - '%PYTHON%\python.exe -m pipenv run pip install -e .' - - '%PYTHON%\python.exe -m pipenv install --dev' - - '%PYTHON%\python.exe -m pipenv --venv' - - '%PYTHON%\python.exe -m pipenv --py' - - '%PYTHON%\python.exe -m pipenv run python --version' +- ps: >- + + $script_path = Join-Path -path $env:PYTHON -childpath Scripts + + $py_exe = Join-Path -path $env:PYTHON -childpath python.exe + + $pipenv_exe = Join-Path -path $script_path -childpath pipenv.exe + + $env:PATH = "$py_path;$script_path;$env:PATH" + + Invoke-Expression "$py_exe -m pip install --upgrade pip invoke" + + Invoke-Expression "$py_exe -m pip install -e ." + + Invoke-Expression "$pipenv_exe install --dev" + + Invoke-Expression "$pipenv_exe --venv" + + Invoke-Expression "$pipenv_exe --py" cache: - - '%LocalAppData%\pip\cache' +- '%LocalAppData%\pip\cache' +- '%LocalAppData%\pipenv\cache' test_script: - - 'if "%RUN_INTEGRATION_TESTS%" == "True" (rmdir /s /q %LocalAppData%\pip\cache)' - - '%PYTHON%\python.exe -m pipenv run pytest -v -n 4 -m "%TEST_SUITE%" tests' + +- ps: >- + $script_path = Join-Path -path $env:PYTHON -childpath Scripts + + $py_exe = Join-Path -path $env:PYTHON -childpath python.exe + + $pipenv_exe = Join-Path -path $script_path -childpath pipenv.exe + + $env:PATH = "$py_path;$script_path;$env:PATH" + + $invoke_path = Join-Path -path $script_path -childpath invoke.exe + + Invoke-Expression "$pipenv_exe run pytest -v -n 4 --ignore=pipenv\patched --ignore=pipenv\vendor -m `"$env:TEST_SUITE`" tests" + + If ($env:RUN_INTEGRATION_TESTS -and ($env:PYTHON_VERSION -eq "3.6.x")) { + + Invoke-Expression "$py_exe -m pip install invoke parver" + + Invoke-Expression "$invoke_path vendoring.update" + + } diff --git a/run-tests.sh b/run-tests.sh index a7059322..ce62ea5a 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -19,6 +19,7 @@ if [[ ! -z "$TEST_SUITE" ]]; then fi export PATH="~/.local/bin:$PATH" +pip uninstall -y pipenv echo "Installing Pipenv…" pip install -e "$(pwd)" --upgrade pipenv install --deploy --dev @@ -50,5 +51,9 @@ echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\"" # Better to run them sequentially. PIPENV_PYTHON=2.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" PIPENV_PYTHON=3.6 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" + +# test revendoring +pip3 install --upgrade invoke requests parver +python3 -m invoke vendoring.update # Cleanup junk. rm -fr .venv diff --git a/tests/integration/test_pipenv.py b/tests/integration/test_pipenv.py index 1b9b66a5..4734cbd7 100644 --- a/tests/integration/test_pipenv.py +++ b/tests/integration/test_pipenv.py @@ -4,11 +4,12 @@ XXX: Try our best to reduce tests in this file. """ import os -from tempfile import gettempdir, mkdtemp +from tempfile import mkdtemp import mock import pytest +from pipenv.utils import temp_environ from pipenv.project import Project from pipenv.vendor import delegator from pipenv._compat import Path @@ -94,14 +95,11 @@ def test_proper_names_unamanged_virtualenv(PipenvInstance, pypi): def test_directory_with_leading_dash(PipenvInstance): def mocked_mkdtemp(suffix, prefix, dir): if suffix == '-project': - temp_dir = Path(gettempdir()) / '-dir-with-leading-dash' - temp_dir.mkdir() - return str(temp_dir) - else: - return mkdtemp(suffix, prefix, dir) + prefix = '-dir-with-leading-dash' + return mkdtemp(suffix, prefix, dir) with mock.patch('pipenv._compat.mkdtemp', side_effect=mocked_mkdtemp): - with PipenvInstance(chdir=True) as p: + with temp_environ(), PipenvInstance(chdir=True) as p: # This environment variable is set in the context manager and will # cause pipenv to use virtualenv, not pew. del os.environ['PIPENV_VENV_IN_PROJECT']