mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Update test runners and fix resolver colorama calls
Signed-off-by: Dan Ryan <dan.ryan@xyleminc.com>
This commit is contained in:
@@ -5,26 +5,27 @@ steps:
|
||||
if (!$env:PY_EXE) {
|
||||
$env:PY_EXE="python"
|
||||
}
|
||||
Write-Host "##vso[task.setvariable variable=PY_EXE]"$env:PY_EXE
|
||||
Write-Host "##vso[task.setvariable variable=PY_EXE]$env:PY_EXE"
|
||||
Write-Host "Found Python: $env:PY_EXE"
|
||||
Invoke-Expression "$env:PY_EXE -m virtualenv D:\.venv"
|
||||
Invoke-Expression "& '$env:PY_EXE' -m virtualenv D:\.venv"
|
||||
Write-Host "##vso[task.setvariable variable=VIRTUAL_ENV]D:\.venv"
|
||||
Invoke-Expression "D:\.venv\Scripts\activate.ps1"
|
||||
Invoke-Expression "& 'D:\.venv\Scripts\activate.ps1'"
|
||||
$env:VIRTUAL_ENV="D:\.venv"
|
||||
Write-Host "Installing local package..."
|
||||
Invoke-Expression "$env:PY_EXE -m pip install -e .[test] --upgrade"
|
||||
Invoke-Expression "& '$env:PY_EXE' -m pip install -e .[test] --upgrade"
|
||||
Write-Host "upgrading local package in virtual env"
|
||||
$venv_scripts = Join-Path -path D:\.venv -childpath Scripts
|
||||
$venv_py = Join-Path -path $venv_scripts -childpath python.exe
|
||||
Invoke-Expression "$venv_py -m pip install -e .[test] --upgrade"
|
||||
Write-Host "##vso[task.setvariable variable=VIRTUAL_ENV_PY]$venv_py"
|
||||
Invoke-Expression "& '$venv_py' -m pip install -e .[test] --upgrade"
|
||||
Write-Host "Installing pipenv development packages"
|
||||
Invoke-Expression "$venv_py -m pipenv install --dev"
|
||||
Invoke-Expression "& '$venv_py' -m pipenv install --dev"
|
||||
Write-Host "Installing local package in pipenv environment"
|
||||
Invoke-Expression "$venv_py -m pipenv run pip install -e .[test]"
|
||||
Invoke-Expression "& '$venv_py' -m pipenv run pip install -e .[test]"
|
||||
Write-Host "Printing metadata"
|
||||
Write-Host $(Invoke-Expression "$venv_py -m pipenv --venv")
|
||||
Write-Host $(Invoke-Expression "$venv_py -m pipenv --py")
|
||||
Write-Host $(Invoke-Expression "$venv_py -m pipenv run python --version")
|
||||
Write-Host $(Invoke-Expression "& '$venv_py' -m pipenv --venv")
|
||||
Write-Host $(Invoke-Expression "& '$venv_py' -m pipenv --py")
|
||||
Write-Host $(Invoke-Expression "& '$venv_py' -m pipenv run python --version")
|
||||
displayName: Make Virtualenv
|
||||
env:
|
||||
PIPENV_DEFAULT_PYTHON_VERSION: $(PIPENV_DEFAULT_PYTHON_VERSION)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
steps:
|
||||
- powershell: |
|
||||
# Fix Git SSL errors
|
||||
pip install certifi
|
||||
python -m certifi > cacert.txt
|
||||
Invoke-Expression "& '$VIRTUAL_ENV_PY' -m pip install certifi"
|
||||
Invoke-Expression "& '$VIRTUAL_ENV_PY' -m certifi > cacert.txt"
|
||||
Write-Host "##vso[task.setvariable variable=GIT_SSL_CAINFO]$(Get-Content cacert.txt)"
|
||||
$env:GIT_SSL_CAINFO="$(Get-Content cacert.txt)"
|
||||
# Shorten paths to get under MAX_PATH or else integration tests will fail
|
||||
@@ -14,8 +14,11 @@ steps:
|
||||
$env:TMP='T:\'
|
||||
git submodule sync
|
||||
git submodule update --init --recursive
|
||||
D:\.venv\Scripts\pipenv run pytest -ra --ignore=pipenv\patched --ignore=pipenv\vendor --junitxml=test-results.xml tests
|
||||
Invoke-Expression "& '$VIRTUAL_ENV_PY' -m pipenv run pytest -ra --ignore=pipenv\patched --ignore=pipenv\vendor --junitxml=test-results.xml tests"
|
||||
displayName: Run integration tests
|
||||
env:
|
||||
VIRTUAL_ENV: $(VIRTUAL_ENV)
|
||||
VIRTUAL_ENV_PY: $(VIRTUAL_ENV_PY)
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Test Results
|
||||
|
||||
+11
-4
@@ -185,10 +185,17 @@ def main():
|
||||
sys.stderr = get_wrapped_stream(stderr)
|
||||
sys.stdout = get_wrapped_stream(stdout)
|
||||
from pipenv.vendor import colorama
|
||||
colorama.init()
|
||||
if os.name == "nt":
|
||||
sys.stderr = colorama.AnsiToWin32(sys.stderr)
|
||||
sys.stdout = colorama.AnsiToWin32(sys.stdout)
|
||||
if os.name == "nt" and (
|
||||
all(getattr(stream, method, None) for stream in [sys.stdout, sys.stderr] for method in ["write", "isatty"]) and
|
||||
all(stream.isatty() for stream in [sys.stdout, sys.stderr])
|
||||
):
|
||||
stderr_wrapper = colorama.AnsiToWin32(sys.stderr, autoreset=False, convert=None, strip=None)
|
||||
stdout_wrapper = colorama.AnsiToWin32(sys.stdout, autoreset=False, convert=None, strip=None)
|
||||
sys.stderr = stderr_wrapper.stream
|
||||
sys.stdout = stdout_wrapper.stream
|
||||
colorama.init(wrap=False)
|
||||
elif os.name != "nt":
|
||||
colorama.init()
|
||||
os.environ["PIP_DISABLE_PIP_VERSION_CHECK"] = str("1")
|
||||
os.environ["PYTHONIOENCODING"] = str("utf-8")
|
||||
parsed = handle_parsed_args(parsed)
|
||||
|
||||
Reference in New Issue
Block a user