django-rest-framework/tox.ini
Bruno Alla b25028ac8f
Add support for Python 3.13 (#9527)
* Add support for Python 3.13

* Fix extracting tox env with -dev Python versions

* Fix view description inspection in Python 3.13

Python 3.13 introduced docstrings for None: https://github.com/python/cpython/pull/117813

In Python 3.12, this is an empty string:

```
 ➜ python3.12
Python 3.12.6 (main, Sep 10 2024, 19:06:17) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> d = None
>>> d.__doc__
>>>
```

In Python 3.13, it's no longer empty:

```
 ➜ python3.13
Python 3.13.0rc2+ (heads/3.13:660baa1, Sep 10 2024, 18:57:50) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> d = None
>>> d.__doc__
'The type of the None singleton.'
>>>
```

Adding a check in the inspector that get the view description out the view function docstring to catch this edge case.
2024-09-11 15:39:52 +06:00

55 lines
1.5 KiB
INI

[tox]
envlist =
{py38,py39}-{django42}
{py310}-{django42,django50,django51,djangomain}
{py311}-{django42,django50,django51,djangomain}
{py312}-{django42,django50,django51,djangomain}
{py313}-{django51,djangomain}
base
dist
docs
[testenv]
commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --coverage {posargs}
envdir = {toxworkdir}/venvs/{envname}
setenv =
PYTHONDONTWRITEBYTECODE=1
PYTHONWARNINGS=once
deps =
django42: Django>=4.2,<5.0
django50: Django>=5.0,<5.1
django51: Django>=5.1,<5.2
djangomain: https://github.com/django/django/archive/main.tar.gz
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt
setuptools
[testenv:base]
; Ensure optional dependencies are not required
deps =
django
-rrequirements/requirements-testing.txt
[testenv:dist]
commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs}
deps =
django
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt
[testenv:docs]
skip_install = true
commands = mkdocs build
deps =
-rrequirements/requirements-testing.txt
-rrequirements/requirements-documentation.txt
[testenv:py310-djangomain]
ignore_outcome = true
[testenv:py311-djangomain]
ignore_outcome = true
[testenv:py312-djangomain]
ignore_outcome = true