You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several tests (such as SQLPanelTestCase.test_cursor_wrapper_singleton)
are written to ensure that only a single cursor wrapper is instantiated
during the test. However, this fails when using Django's psycopg3
backend, since the .last_executed_query() call in
NormalCursorWrapper._record() ends up creating an additional cursor (via
[1]). To avoid this wrapping this additional cursor, set the
DatabaseWrapper's ._djdt_logger attribute to None before calling
.last_executed_query() and restore it when finished. This will cause
the monkey-patched DatabaseWrapper .cursor() and .chunked_cursor()
methods to return the original cursor without wrapping during that call.
[1] https://github.com/django/django/blob/4.2.1/django/db/backends/postgresql/psycopg_any.py#L21
0 commit comments