From a6dce8408f2a958333f6bebf17df9e9e0b23ef62 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:03:57 -0800 Subject: [PATCH] Upgrade to tox v4 (#14579) --- .github/workflows/docs.yml | 6 +++--- .github/workflows/test.yml | 12 ++++++------ CONTRIBUTING.md | 6 +++--- docs/source/existing_code.rst | 2 +- tox.ini | 7 +++++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9f984e3a346b..a3294c08a79c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,8 +26,8 @@ jobs: with: python-version: '3.7' - name: Install tox - run: pip install --upgrade 'setuptools!=50' tox==3.24.5 + run: pip install --upgrade 'setuptools!=50' tox==4.4.4 - name: Setup tox environment - run: tox -e ${{ env.TOXENV }} --notest + run: tox run -e ${{ env.TOXENV }} --notest - name: Test - run: tox -e ${{ env.TOXENV }} --skip-pkg-install + run: tox run -e ${{ env.TOXENV }} --skip-pkg-install diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a02378cc01ab..e7072f5369c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -127,16 +127,16 @@ jobs: ./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV source $VENV/bin/activate - name: Install tox - run: pip install --upgrade 'setuptools!=50' tox==3.24.5 + run: pip install --upgrade 'setuptools!=50' tox==4.4.4 - name: Compiled with mypyc if: ${{ matrix.test_mypyc }} run: | pip install -r test-requirements.txt CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e . - name: Setup tox environment - run: tox -e ${{ matrix.toxenv }} --notest + run: tox run -e ${{ matrix.toxenv }} --notest - name: Test - run: tox -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }} + run: tox run -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }} python-nightly: runs-on: ubuntu-latest @@ -147,11 +147,11 @@ jobs: with: python-version: '3.12-dev' - name: Install tox - run: pip install --upgrade 'setuptools!=50' tox==3.24.5 + run: pip install --upgrade 'setuptools!=50' tox==4.4.4 - name: Setup tox environment - run: tox -e py --notest + run: tox run -e py --notest - name: Test - run: tox -e py --skip-pkg-install -- "-n 2" + run: tox run -e py --skip-pkg-install -- "-n 2" continue-on-error: true - name: Mark as a success run: exit 0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 193c9f27c85b..2b2e6cdb9734 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,13 +53,13 @@ python3 runtests.py You can also use `tox` to run tests (`tox` handles setting up the test environment for you): ``` -tox -e py +tox run -e py # Or some specific python version: -tox -e py39 +tox run -e py39 # Or some specific command: -tox -e lint +tox run -e lint ``` Some useful commands for running specific tests include: diff --git a/docs/source/existing_code.rst b/docs/source/existing_code.rst index 5b1fda40f2d6..410d7af0c350 100644 --- a/docs/source/existing_code.rst +++ b/docs/source/existing_code.rst @@ -51,7 +51,7 @@ A simple CI script could look something like this: python3 -m pip install mypy==0.971 # Run your standardised mypy invocation, e.g. mypy my_project - # This could also look like `scripts/run_mypy.sh`, `tox -e mypy`, `make mypy`, etc + # This could also look like `scripts/run_mypy.sh`, `tox run -e mypy`, `make mypy`, etc Ignoring errors from certain modules ------------------------------------ diff --git a/tox.ini b/tox.ini index df7784f0731f..443f05dc8bcf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 3.8.0 +minversion = 4.4.4 skip_missing_interpreters = {env:TOX_SKIP_MISSING_INTERPRETERS:True} envlist = py37, @@ -30,7 +30,10 @@ commands = [testenv:type] description = type check ourselves -passenv = TERM MYPY_FORCE_COLOR MYPY_FORCE_TERMINAL_WIDTH +passenv = + TERM + MYPY_FORCE_COLOR + MYPY_FORCE_TERMINAL_WIDTH commands = python -m mypy --config-file mypy_self_check.ini -p mypy -p mypyc python -m mypy --config-file mypy_self_check.ini misc --exclude misc/fix_annotate.py --exclude misc/async_matrix.py --exclude misc/sync-typeshed.py