1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Date: Tue, 20 Feb 2024 20:59:26 +0100
Subject: Refs #34900 -- Fixed
CommandTypes.test_help_default_options_with_custom_arguments test on Python
3.13+.
https://github.com/python/cpython/commit/c4a2e8a2c5188c3288d57b80852e92c83f46f6f3
Origin: backport, https://github.com/django/django/commit/3426a5c33c36266af42128ee9eca4921e68ea876
Bug: https://code.djangoproject.com/ticket/34900
Bug-Debian: https://bugs.debian.org/1082209
Last-Update: 2025-01-02
---
django/utils/version.py | 1 +
tests/admin_scripts/tests.py | 16 +++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/django/utils/version.py b/django/utils/version.py
index 1e9c7202990f..71ec70bd67c4 100644
--- a/django/utils/version.py
+++ b/django/utils/version.py
@@ -17,6 +17,7 @@ PY39 = sys.version_info >= (3, 9)
PY310 = sys.version_info >= (3, 10)
PY311 = sys.version_info >= (3, 11)
PY312 = sys.version_info >= (3, 12)
+PY313 = sys.version_info >= (3, 13)
def get_version(version=None):
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 6d67c2931a5d..4a56f31e98b4 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -32,7 +32,7 @@ from django.db.migrations.recorder import MigrationRecorder
from django.test import LiveServerTestCase, SimpleTestCase, TestCase, override_settings
from django.test.utils import captured_stderr, captured_stdout
from django.urls import path
-from django.utils.version import PY39
+from django.utils.version import PY39, PY313
from django.views.static import serve
from . import urls
@@ -1900,10 +1900,16 @@ class CommandTypes(AdminScriptTestCase):
]
for option in expected_options:
self.assertOutput(out, f"[{option}]")
- self.assertOutput(out, "--option_a OPTION_A, -a OPTION_A")
- self.assertOutput(out, "--option_b OPTION_B, -b OPTION_B")
- self.assertOutput(out, "--option_c OPTION_C, -c OPTION_C")
- self.assertOutput(out, "-v {0,1,2,3}, --verbosity {0,1,2,3}")
+ if PY313:
+ self.assertOutput(out, "--option_a, -a OPTION_A")
+ self.assertOutput(out, "--option_b, -b OPTION_B")
+ self.assertOutput(out, "--option_c, -c OPTION_C")
+ self.assertOutput(out, "-v, --verbosity {0,1,2,3}")
+ else:
+ self.assertOutput(out, "--option_a OPTION_A, -a OPTION_A")
+ self.assertOutput(out, "--option_b OPTION_B, -b OPTION_B")
+ self.assertOutput(out, "--option_c OPTION_C, -c OPTION_C")
+ self.assertOutput(out, "-v {0,1,2,3}, --verbosity {0,1,2,3}")
def test_color_style(self):
style = color.no_style()
|