diff --git a/.azure-pipelines/jobs/package.yml b/.azure-pipelines/jobs/package.yml deleted file mode 100644 index 8663720de9c..00000000000 --- a/.azure-pipelines/jobs/package.yml +++ /dev/null @@ -1,36 +0,0 @@ -parameters: - vmImage: - -jobs: -- job: Package - dependsOn: - - Test_Primary - - Test_Secondary - pool: - vmImage: ${{ parameters.vmImage }} - - steps: - - task: UsePythonVersion@0 - displayName: Use Python 3 latest - inputs: - versionSpec: '3' - - - bash: | - git config --global user.email "pypa-dev@googlegroups.com" - git config --global user.name "pip" - displayName: Setup Git credentials - - - bash: pip install nox - displayName: Install dependencies - - - bash: nox -s prepare-release -- 99.9 - displayName: Prepare dummy release - - - bash: nox -s build-release -- 99.9 - displayName: Generate distributions for the dummy release - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: dist' - inputs: - pathtoPublish: dist - artifactName: dist diff --git a/.azure-pipelines/jobs/test-windows.yml b/.azure-pipelines/jobs/test-windows.yml index 1a933a6934b..bf2c84454c2 100644 --- a/.azure-pipelines/jobs/test-windows.yml +++ b/.azure-pipelines/jobs/test-windows.yml @@ -2,67 +2,85 @@ parameters: vmImage: jobs: -- job: Test_Primary - displayName: Test Primary +- job: Test_Primary_one + displayName: Tests / Windows / pool: vmImage: ${{ parameters.vmImage }} strategy: matrix: - Python27-x86: + "2.7-x86 / 1": python.version: '2.7' python.architecture: x86 - Python27-x64: + "2.7 / 1": python.version: '2.7' python.architecture: x64 - useVenv: true - Python35-x64: - python.version: '3.5' - python.architecture: x64 - Python36-x64: - python.version: '3.6' + "3.8 / 1": + python.version: '3.8' python.architecture: x64 - useVenv: true - Python37-x64: - python.version: '3.7' + + steps: + - template: ../steps/run-tests-windows.yml + parameters: + testGroup: one + +- job: Test_Primary_two + displayName: Tests / Windows / + + pool: + vmImage: ${{ parameters.vmImage }} + strategy: + matrix: + "2.7-x86 / 2": + python.version: '2.7' + python.architecture: x86 + "2.7 / 2": + python.version: '2.7' python.architecture: x64 - Python38-x64: + "3.8 / 2": python.version: '3.8' python.architecture: x64 - maxParallel: 6 steps: - template: ../steps/run-tests-windows.yml parameters: - runIntegrationTests: true - useVenv: '$(useVenv)' + testGroup: two - job: Test_Secondary - displayName: Test Secondary + displayName: Tests / Windows / # Don't run integration tests for these runs - # Run after Test_Primary so we don't devour time and jobs if tests are going to fail - dependsOn: Test_Primary + # Run after Test_Primary_* so we don't devour time and jobs. + dependsOn: + - Test_Primary_one + - Test_Primary_two pool: vmImage: ${{ parameters.vmImage }} strategy: matrix: - # This is for Windows, so test x86 builds - Python35-x86: + 3.5: + python.version: '3.5' + python.architecture: x64 + 3.6: + python.version: '3.6' + python.architecture: x64 + 3.7: + python.version: '3.7' + python.architecture: x64 + 3.5-x86: python.version: '3.5' python.architecture: x86 - Python36-x86: + 3.6-x86: python.version: '3.6' python.architecture: x86 - Python37-x86: + 3.7-x86: python.version: '3.7' python.architecture: x86 - Python38-x86: + 3.8-x86: python.version: '3.8' python.architecture: x86 - maxParallel: 6 steps: - template: ../steps/run-tests-windows.yml parameters: - runIntegrationTests: false + testGroup: unit diff --git a/.azure-pipelines/jobs/test.yml b/.azure-pipelines/jobs/test.yml deleted file mode 100644 index cadf99a51f7..00000000000 --- a/.azure-pipelines/jobs/test.yml +++ /dev/null @@ -1,41 +0,0 @@ -parameters: - vmImage: - -jobs: -- job: Test_Primary - displayName: Test Primary - - pool: - vmImage: ${{ parameters.vmImage }} - strategy: - matrix: - Python27: - python.version: '2.7' - python.architecture: x64 - Python36: - python.version: '3.6' - python.architecture: x64 - maxParallel: 2 - - steps: - - template: ../steps/run-tests.yml - -- job: Test_Secondary - displayName: Test Secondary - # Run after Test_Primary so we don't devour time and jobs if tests are going to fail - dependsOn: Test_Primary - - pool: - vmImage: ${{ parameters.vmImage }} - strategy: - matrix: - Python35: - python.version: '3.5' - python.architecture: x64 - Python37: - python.version: '3.7' - python.architecture: x64 - maxParallel: 3 - - steps: - - template: ../steps/run-tests.yml diff --git a/.azure-pipelines/linux.yml b/.azure-pipelines/linux.yml deleted file mode 100644 index 6965a15fc6d..00000000000 --- a/.azure-pipelines/linux.yml +++ /dev/null @@ -1,8 +0,0 @@ -jobs: -- template: jobs/test.yml - parameters: - vmImage: ubuntu-16.04 - -- template: jobs/package.yml - parameters: - vmImage: ubuntu-16.04 diff --git a/.azure-pipelines/macos.yml b/.azure-pipelines/macos.yml deleted file mode 100644 index 85c2a0246af..00000000000 --- a/.azure-pipelines/macos.yml +++ /dev/null @@ -1,8 +0,0 @@ -jobs: -- template: jobs/test.yml - parameters: - vmImage: macos-10.14 - -- template: jobs/package.yml - parameters: - vmImage: macos-10.14 diff --git a/.azure-pipelines/steps/run-tests-windows.yml b/.azure-pipelines/steps/run-tests-windows.yml index 3832e46621b..653a1f58f5d 100644 --- a/.azure-pipelines/steps/run-tests-windows.yml +++ b/.azure-pipelines/steps/run-tests-windows.yml @@ -1,6 +1,10 @@ parameters: - runIntegrationTests: - useVenv: false +- name: testGroup + type: string + values: + - unit + - one + - two steps: - task: UsePythonVersion@0 @@ -28,15 +32,17 @@ steps: - bash: pip install --upgrade 'virtualenv<20' setuptools tox displayName: Install Tox -- script: tox -e py -- -m unit -n auto --junit-xml=junit/unit-test.xml - env: - TEMP: "R:\\Temp" - displayName: Tox run unit tests +# Lots of fun logic, for... running the correct tests. +- ${{ if in(parameters.testGroup, 'unit', 'one') }}: + - script: tox -e py -- -m unit -n auto --junit-xml=junit/unit-test.xml + env: + TEMP: "R:\\Temp" + displayName: Run unit tests -- ${{ if eq(parameters.runIntegrationTests, 'true') }}: +- ${{ if in(parameters.testGroup, 'one', 'two') }}: - powershell: | # Fix Git SSL errors - pip install certifi tox + pip install certifi python -m certifi > cacert.txt $env:GIT_SSL_CAINFO = $(Get-Content cacert.txt) @@ -44,11 +50,14 @@ steps: # https://bugs.python.org/issue18199 $env:TEMP = "R:\Temp" - tox -e py -- $env:USE_VENV_ARG -m integration -n auto --duration=5 --junit-xml=junit/integration-test.xml - displayName: Tox run integration tests + pip install tox + tox -e py -- -k $env:SELECTOR -m integration -n auto --duration=5 --junit-xml=junit/integration-test.xml env: - ${{ if eq(parameters.useVenv, 'true') }}: - USE_VENV_ARG: "--use-venv" + ${{ if eq(parameters.testGroup, 'one') }}: + SELECTOR: "not test_install" + ${{ if eq(parameters.testGroup, 'two') }}: + SELECTOR: "test_install" + displayName: Run integration tests - task: PublishTestResults@2 displayName: Publish Test Results diff --git a/.azure-pipelines/steps/run-tests.yml b/.azure-pipelines/steps/run-tests.yml deleted file mode 100644 index 11ea2272728..00000000000 --- a/.azure-pipelines/steps/run-tests.yml +++ /dev/null @@ -1,25 +0,0 @@ -steps: -- task: UsePythonVersion@0 - displayName: Use Python $(python.version) - inputs: - versionSpec: '$(python.version)' - -- bash: pip install --upgrade 'virtualenv<20' setuptools tox - displayName: Install Tox - -- script: tox -e py -- -m unit -n auto --junit-xml=junit/unit-test.xml - displayName: Tox run unit tests - -# Run integration tests in two groups so we will fail faster if there is a failure in the first group -- script: tox -e py -- -m integration -n auto --duration=5 -k "not test_install" --junit-xml=junit/integration-test-group0.xml - displayName: Tox run Group 0 integration tests - -- script: tox -e py -- -m integration -n auto --duration=5 -k "test_install" --junit-xml=junit/integration-test-group1.xml - displayName: Tox run Group 1 integration tests - -- task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFiles: junit/*.xml - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index 9d1bf5385d0..fa4910dcfed 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -2,7 +2,3 @@ jobs: - template: jobs/test-windows.yml parameters: vmImage: vs2017-win2016 - -- template: jobs/package.yml - parameters: - vmImage: vs2017-win2016 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..f20c3e622ef --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,141 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + schedule: + # Run every Friday at 18:02 UTC + - cron: 2 18 * * 5 + +jobs: + dev-tools: + name: Quality Check / ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + + strategy: + matrix: + os: [Ubuntu, Windows, MacOS] + + steps: + # Caches + - name: pip cache + uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + - name: Set PY (for pre-commit cache) + run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" + - name: pre-commit cache + uses: actions/cache@v1 + with: + path: ~/.cache/pre-commit + key: pre-commit|2020-02-14|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + + # Setup + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + + - name: Install tox + run: python -m pip install tox + + # Main check + - run: python -m tox -e "lint,docs" + + packaging: + name: Packaging / ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + + strategy: + matrix: + os: [Ubuntu, Windows, MacOS] + + steps: + # Caches + - name: pip cache + uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + # Setup + - name: Set up git credentials + run: | + git config --global user.email "pypa-dev@googlegroups.com" + git config --global user.name "pip" + + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install tox and nox + run: python -m pip install tox nox + + # Main check + - name: Check vendored packages + run: python -m tox -e "vendoring" + + - name: Prepare dummy release + run: nox -s prepare-release -- 99.9 + + - name: Generate distributions for the dummy release + run: nox -s build-release -- 99.9 + + tests: + name: Tests / ${{ matrix.python }} / ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + + needs: dev-tools + + strategy: + fail-fast: false + matrix: + os: [Ubuntu, MacOS] + python: [2.7, 3.5, 3.6, 3.7, 3.8] + + steps: + # Caches + - name: pip cache + uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + # Setup + - uses: actions/checkout@v2 + - uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + + - name: Install tox + run: python -m pip install tox 'virtualenv<20' + + # Main check + - name: Run unit tests + run: >- + python -m tox -e py -- + -m unit + --verbose + --numprocesses auto + - name: Run integration tests + run: >- + python -m tox -e py -- + -m integration + --verbose + --numprocesses auto + --duration=5 diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml deleted file mode 100644 index 512969b0dff..00000000000 --- a/.github/workflows/linting.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Linting - -on: - push: - pull_request: - schedule: - # Run every Friday at 18:02 UTC - - cron: 2 18 * * 5 - -jobs: - lint: - name: ${{ matrix.os }} - runs-on: ${{ matrix.os }}-latest - env: - TOXENV: lint,docs,vendoring - - strategy: - matrix: - os: - - Ubuntu - - Windows - - MacOS - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - # Setup Caching - - name: pip cache - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - - name: Set PY (for pre-commit cache) - run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - - name: pre-commit cache - uses: actions/cache@v1 - with: - path: ~/.cache/pre-commit - key: pre-commit|2020-02-14|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - - # Get the latest tox - - name: Install tox - run: python -m pip install tox - - # Main check - - run: python -m tox diff --git a/.travis.yml b/.travis.yml index b44b07b1e99..5200e47f5e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,28 +8,19 @@ addons: - bzr stages: -- primary -- secondary -- experimental +- Quality Checks +- PyPy on Ubuntu +- Experimental jobs: include: # Basic Checks - - stage: primary + - stage: Quality Checks env: TOXENV=docs - env: TOXENV=lint - - env: TOXENV=vendoring - # Latest CPython - - env: GROUP=1 - python: 2.7 - - env: GROUP=2 - python: 2.7 - - env: GROUP=1 - - env: GROUP=2 - # Complete checking for ensuring compatibility # PyPy - - stage: secondary + - stage: PyPy on Ubuntu env: GROUP=1 python: pypy3.5-7.0.0 - env: GROUP=2 @@ -38,23 +29,10 @@ jobs: python: pypy2.7-7.1.1 - env: GROUP=2 python: pypy2.7-7.1.1 - # Other Supported CPython - - env: GROUP=1 - python: 3.7 - - env: GROUP=2 - python: 3.7 - - env: GROUP=1 - python: 3.6 - - env: GROUP=2 - python: 3.6 - - env: GROUP=1 - python: 3.5 - - env: GROUP=2 - python: 3.5 # Test experimental stuff that are not part of the standard pip usage. # Helpful for developers working on them to see how they're doing. - - stage: experimental + - stage: Experimental env: - GROUP=1 - PIP_UNSTABLE_FEATURE=resolver @@ -64,7 +42,7 @@ jobs: fast_finish: true allow_failures: - - stage: experimental + - stage: Experimental before_install: tools/travis/setup.sh install: travis_retry tools/travis/install.sh diff --git a/tests/unit/test_locations.py b/tests/unit/test_locations.py index 3d24f717387..9bd4e07c8b5 100644 --- a/tests/unit/test_locations.py +++ b/tests/unit/test_locations.py @@ -94,20 +94,23 @@ def test_root_modifies_appropriately(self, monkeypatch): @pytest.mark.incompatible_with_venv def test_distutils_config_file_read(self, tmpdir, monkeypatch): # This deals with nt/posix path differences - install_scripts = os.path.normcase(os.path.abspath( - os.path.join(os.path.sep, 'somewhere', 'else'))) + install_scripts = os.path.normcase( + os.path.abspath(os.path.join(os.path.sep, 'somewhere', 'else')) + ) + f = tmpdir / "config" / "setup.cfg" f.parent.mkdir() f.write_text("[install]\ninstall-scripts=" + install_scripts) - from distutils.dist import Distribution + # patch the function that returns what config files are present + from distutils.dist import Distribution monkeypatch.setattr( Distribution, 'find_config_files', lambda self: [f], ) scheme = distutils_scheme('example') - assert scheme['scripts'] == install_scripts + assert scheme['scripts'] == install_scripts, scheme @pytest.mark.incompatible_with_venv # when we request install-lib, we should install everything (.py &