#37064: SimpleTestCase._remove_databases_failures() crashes on un-wrapped
connection methods
-------------------------------------+-------------------------------------
Reporter: Rio Weber | Owner: (none)
Type: Bug | Status: new
Component: Testing framework | Version: 6.0
Severity: Normal | Resolution:
Keywords: testcase, | Triage Stage:
databases, multi-db, regression | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Rio Weber):
Replying to [comment:11 Simon Charette]:
So my friend, do you want an example using `django-debug-toolbar` or
`django-silk` or `graphene-django` ?
Like it or not I'm going to get you a real word example of a
connection.cursor replacement 🤪 ,,,, it's how every major Django SQL
observability tool work
> I'll let other triagers chime in but to me [https://github.com/riodw
/django-remove_databases_failures-
demo/blob/3e712b13c558a43458f457ab6b7e110a56390051/demo/repro/tests.py#L16-L22
this doesn't constitute a valid reproduction case].
>
> If you mock with Django internals in your `setUp` it's your
responsibility to restore things to how they were prior to `tearDown`
exit. If you properly do so with
>
> {{{#!python
> self.addCleanup(setattr, connection, "cursor", original_cursor)
> }}}
>
> you won't run into any problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/37064#comment:13>
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/0107019dc28ada05-962744a2-0098-4ef0-8971-988df39c5f99-000000%40eu-central-1.amazonses.com.