diff options
author | Bernat Gabor <gaborjbernat@gmail.com> | 2018-10-28 13:07:54 +0000 |
---|---|---|
committer | Bernat Gabor <gaborjbernat@gmail.com> | 2018-10-28 16:54:00 +0000 |
commit | 5dbf019ff348fe9a0bc80b6c0868a71d7196bd87 (patch) | |
tree | 1b6c132d20002014cbfd995cc934cd01c7480693 | |
parent | 3bcb31b75276f6cb689e248fc17a5fb1546d2f3a (diff) | |
download | virtualenv-5dbf019ff348fe9a0bc80b6c0868a71d7196bd87.tar.gz |
Jython to CIjython
-rw-r--r-- | azure-pipelines.yml | 3 | ||||
-rw-r--r-- | azure-run-tox-env.yml | 33 | ||||
-rwxr-xr-x | src/virtualenv.py | 8 | ||||
-rw-r--r-- | tests/test_virtualenv.py | 6 | ||||
-rw-r--r-- | tox.ini | 11 |
5 files changed, 42 insertions, 19 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 07deb07..e52b060 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,6 +21,9 @@ trigger: jobs: - template: azure-run-tox-env.yml + parameters: {tox: jython, python: 3.7, os: linux} + +- template: azure-run-tox-env.yml parameters: {tox: fix_lint, python: 3.7} - template: azure-run-tox-env.yml parameters: {tox: embed, python: 3.7} diff --git a/azure-run-tox-env.yml b/azure-run-tox-env.yml index a0338a7..6dd6e56 100644 --- a/azure-run-tox-env.yml +++ b/azure-run-tox-env.yml @@ -21,29 +21,46 @@ jobs: steps: # ensure the required Python versions are available - - ${{ if notIn(parameters.python, 'pypy', 'pypy3') }}: + - ${{ if notIn(parameters.python, 'pypy', 'pypy3', 'jython') }}: - task: UsePythonVersion@0 displayName: setup python inputs: versionSpec: ${{ parameters.python }} + - ${{ if eq(parameters.tox, 'jython') }}: + - script: "wget http://search.maven.org/remotecontent?filepath=org/python/jython-installer/2.7.1/jython-installer-2.7.1.jar -O $(Agent.ToolsDirectory)/jython.jar" + displayName: download jython + + - script: "java -jar $(Agent.ToolsDirectory)/jython.jar -sd $(Agent.ToolsDirectory)/jython -e demo src doc" + displayName: install jython + + - script: echo "##vso[task.setvariable variable=PATH]$(Agent.ToolsDirectory)/jython/bin:$(PATH)" + displayName: setvarStep + + - script: echo $(PATH) + displayName: show PATH + - script: "$(python) -c \"import sys; print(sys.version); print(sys.executable)\"" displayName: show python information - - script: "python -m pip install -U pip setuptools --user -v" - displayName: upgrade pip and setuptools + - script: "python -m pip install -U pip setuptools --user" + displayName: install pip - - script: "python -m pip install -U tox --pre --user -v" + - script: "python -m pip install -U tox --user -v" displayName: install tox - - script: ${{ format('python -m tox -e {0} --notest', parameters.tox) }} + - ${{ if eq(parameters.tox, 'jython') }}: + - script: "python -m pip install --user $(System.DefaultWorkingDirectory)" + displayName: install dev venv for tox + + - script: ${{ format('python -m tox -e {0} --notest --skip-missing-interpreters=false', parameters.tox) }} displayName: install test dependencies - ${{ if startsWith(parameters.tox, 'py') }}: - - script: python -m tox -e coverage --notest + - script: python -m tox -e coverage --notest --skip-missing-interpreters=false displayName: install coverage dependencies - - script: ${{ format('python -m tox -e {0}', parameters.tox) }} + - script: ${{ format('python -m tox --skip-missing-interpreters=false -e {0}', parameters.tox) }} displayName: run tests - ${{ if and( startsWith(parameters.tox, 'py'), eq(variables['system.pullrequest.isfork'], false) ) }}: @@ -56,7 +73,7 @@ jobs: testRunTitle: ${{ format('{0}_{1}', parameters.os, parameters.tox) }} - ${{ if startsWith(parameters.tox, 'py') }}: - - script: "python -m tox -e coverage" + - script: "python -m tox --skip-missing-interpreters=false -e coverage" displayName: create coverag report condition: succeededOrFailed() diff --git a/src/virtualenv.py b/src/virtualenv.py index 1fae20a..1de4e0c 100755 --- a/src/virtualenv.py +++ b/src/virtualenv.py @@ -894,7 +894,7 @@ def install_wheel(project_names, py_executable, search_dirs=None, download=False search_dirs = file_search_dirs() wheels = find_wheels(["setuptools", "pip"], search_dirs) - pythonpath = os.pathsep.join(wheels) + python_path = os.pathsep.join(wheels) # PIP_FIND_LINKS uses space as the path separator and thus cannot have paths # with spaces in them. Convert any of those to local file:// URL form. @@ -936,7 +936,7 @@ def install_wheel(project_names, py_executable, search_dirs=None, download=False try: args = ["install", "--ignore-installed"] if cert_file is not None: - args += ["--cert", cert_file.name] + args += ["--cert", cert_file.name, "-vvv", "--no-cache"] args += sys.argv[1:] sys.exit(_main(args)) @@ -951,8 +951,8 @@ def install_wheel(project_names, py_executable, search_dirs=None, download=False logger.indent += 2 env = { - "PYTHONPATH": pythonpath, - "JYTHONPATH": pythonpath, # for Jython < 3.x + "PYTHONPATH": python_path, + "JYTHONPATH": python_path, # for Jython < 3.x "PIP_FIND_LINKS": findlinks, "PIP_USE_WHEEL": "1", "PIP_ONLY_BINARY": ":all:", diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py index 27f3d10..a48c5e4 100644 --- a/tests/test_virtualenv.py +++ b/tests/test_virtualenv.py @@ -5,10 +5,14 @@ import sys import tempfile import pytest -from mock import NonCallableMock, call, patch import virtualenv +try: + from unittest.mock import NonCallableMock, call, patch +except ImportError: + from mock import NonCallableMock, call, patch + def test_version(): """Should have a version string""" @@ -11,13 +11,13 @@ setenv = PIP_DISABLE_VERSION_CHECK = 1 extras = testing commands = coverage run --source=virtualenv \ --rcfile="{toxinidir}/tox.ini" \ - {envbindir}/pytest tests + -m pytest tests \ {posargs:\ - --junitxml={env:JUNIT_XML_FILE:{toxworkdir}/.test.{envname}.xml} + --junitxml={env:JUNIT_XML_FILE:{toxworkdir}/.test.{envname}.xml} \ !jython: --timeout=180 \ } coverage combine --rcfile="{toxinidir}/tox.ini" - !jython: coverage report -m --rcfile="{toxinidir}/tox.ini" + !jython: coverage report --show-missing --rcfile="{toxinidir}/tox.ini" [testenv:.package] deps = @@ -47,8 +47,7 @@ extras = skip_install = True passenv = DIFF_AGAINST setenv = COVERAGE_FILE={toxworkdir}/.coverage -commands = coverage erase --rcfile="{toxinidir}/tox.ini" - coverage combine --rcfile="{toxinidir}/tox.ini" +commands = coverage combine --rcfile="{toxinidir}/tox.ini" coverage report --show-missing --rcfile="{toxinidir}/tox.ini" coverage xml -o {toxworkdir}/coverage.xml --rcfile="{toxinidir}/tox.ini" coverage html -d {toxworkdir}/htmlcov --rcfile="{toxinidir}/tox.ini" @@ -113,7 +112,7 @@ force_grid_wrap = 0 line_length = 120 known_standard_library = ConfigParser known_first_party = virtualenv -known_third_party = mock,pytest +known_third_party = pytest [flake8] max-complexity = 22 |