#36158: get_and_report_namespace() incorrectly reports the location where an
object
was created.
-------------------------------------+-------------------------------------
Reporter: Salvo Polizzi | Owner: Salvo
| Polizzi
Type: Bug | Status: assigned
Component: Core (Management | Version: 5.2
commands) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
* version: dev => 5.2
Comment:
I can replicate it. I also think it would be nice to say "1 object" rather
than "1 objects".
Happy for you to take a look. Marking as a release blocker but I think
this can be de-escalated if need be
{{{#!diff
--- a/tests/shell/tests.py
+++ b/tests/shell/tests.py
@@ -271,6 +271,22 @@ class
ShellCommandAutoImportsTestCase(SimpleTestCase):
" from shell.models import Phone, Marker",
)
+ def test_message_with_stdout_listing_objects_location(self):
+ class TestCommand(shell.Command):
+ def get_namespace(self):
+ from django.db import connection
+
+ return {"connection": connection}
+
+ with captured_stdout() as stdout:
+ TestCommand().get_and_report_namespace(verbosity=2)
+
+ self.assertEqual(
+ stdout.getvalue().strip(),
+ "1 object imported automatically, including:\n\n"
+ " from django.db import connection"
+ )
+
@override_settings(INSTALLED_APPS=["shell",
"django.contrib.contenttypes"])
def test_message_with_stdout_listing_objects_with_isort(self):
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36158#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070194bd6f3221-8b98cc21-cc5f-4e7c-be28-3fce319b9aac-000000%40eu-central-1.amazonses.com.