Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test updates #2434

Merged
merged 18 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 73 additions & 16 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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"

}
5 changes: 5 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
12 changes: 5 additions & 7 deletions tests/integration/test_pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"""

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
Expand Down Expand Up @@ -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']
Expand Down