summaryrefslogtreecommitdiff
path: root/tests/admin_scripts/tests.py
diff options
context:
space:
mode:
authorTainara Palmeira <tainarapalmeirag@gmail.com>2024-10-24 11:27:56 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-10-25 13:30:11 +0200
commit4c3897bb154a3d3a94e5f7e146d0b8bf41e27d81 (patch)
treee9f5a864b13653a2cbea0632b3a2a1487dc6a3c1 /tests/admin_scripts/tests.py
parent7a1fa20e9bca47c4c70734aec99209e402e0f076 (diff)
Refs #35844 -- Corrected expected error messages in commands tests on Python 3.14+.
Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to address changes in Python 3.14+ error handling.
Diffstat (limited to 'tests/admin_scripts/tests.py')
-rw-r--r--tests/admin_scripts/tests.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 29023b74c3..fefe4f50bb 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -34,7 +34,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 PY313, get_docs_version
+from django.utils.version import PY313, PY314, get_docs_version
from django.views.static import serve
from . import urls
@@ -2355,10 +2355,16 @@ class Discovery(SimpleTestCase):
class CommandDBOptionChoiceTests(SimpleTestCase):
def test_invalid_choice_db_option(self):
- expected_error = (
- "Error: argument --database: invalid choice: "
- "'deflaut' (choose from 'default', 'other')"
- )
+ if PY314:
+ expected_error = (
+ "Error: argument --database: invalid choice: 'deflaut' "
+ "(choose from default, other)"
+ )
+ else:
+ expected_error = (
+ "Error: argument --database: invalid choice: 'deflaut' "
+ "(choose from 'default', 'other')"
+ )
args = [
"changepassword",
"createsuperuser",