Skip to content

Upgrade to tox 4 #8795

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

Merged
merged 9 commits into from
Dec 8, 2022
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
14 changes: 10 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,24 @@ jobs:
run: python -m pip install --upgrade pip setuptools virtualenv wheel

- name: Install dependencies
run: python -m pip install --upgrade codecov tox tox-py
run: python -m pip install --upgrade codecov tox

- name: Install tox-py
if: ${{ matrix.python-version == '3.6' }}
run: python -m pip install --upgrade tox-py

- name: Run tox targets for ${{ matrix.python-version }}
if: ${{ matrix.python-version != '3.6' }}
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)

- name: Run tox targets for ${{ matrix.python-version }}
if: ${{ matrix.python-version == '3.6' }}
run: tox --py current

- name: Run extra tox targets
if: ${{ matrix.python-version == '3.9' }}
run: |
python setup.py bdist_wheel
rm -r djangorestframework.egg-info # see #6139
tox -e base,dist,docs
tox -e dist --installpkg ./dist/djangorestframework-*.whl
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this run is no longer required because tox now uses isolated builds by default.

We need to remove it because --installpkg seems to be incompatible with deps, or some other option we're using, leading to:

ROOT: HandledError| .pkg_external is already defined as a virtualenv-cmd-builder, cannot be virtualenv-pep-517 too


- name: Upload coverage
run: |
Expand Down
25 changes: 9 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
[tox]
envlist =
{py36,py37,py38,py39}-django30,
{py36,py37,py38,py39}-django31,
{py36,py37,py38,py39,py310}-django32,
{py38,py39,py310}-{django40,django41,djangomain},
{py311}-{django41,djangomain},
base,dist,docs,

[travis:env]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config for tox-travis, I missed removing it in #7903

DJANGO =
3.0: django30
3.1: django31
3.2: django32
4.0: django40
4.1: django41
main: djangomain
{py36,py37,py38,py39}-django30
{py36,py37,py38,py39}-django31
{py36,py37,py38,py39,py310}-django32
{py38,py39,py310}-{django40,django41,djangomain}
{py311}-{django41,djangomain}
base
dist
docs
Comment on lines +3 to +10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is not necessary but it will reduce diff noise going forwards


[testenv]
commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --coverage {posargs}
Expand All @@ -39,7 +32,7 @@ deps =
-rrequirements/requirements-testing.txt

[testenv:dist]
commands = ./runtests.py --no-pkgroot --staticfiles {posargs}
commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tox no longer allows ./runtests.py to work, failing with:

dist: failed with ./runtests.py (resolves to ./runtests.py) is not allowed, use allowlist_externals to allow it

but we can use python runtests.py instead

I also added the warning flags as added to the main [testenv] in #7900

deps =
django
-rrequirements/requirements-testing.txt
Expand Down