summaryrefslogtreecommitdiff
path: root/tests/servers
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-02-14 07:04:55 -0800
committerTim Graham <timograham@gmail.com>2019-02-14 10:05:13 -0500
commit37cc6a9dce3354cd37f23ee972bc25b0e5cebd5c (patch)
tree90f49316a7b3104b924c5556491ba56e803b04f2 /tests/servers
parent07b44a251a41ca93a7f5593761fcf808249665f0 (diff)
[2.2.x] Fixed #30171 -- Fixed DatabaseError in servers tests.
Made DatabaseWrapper thread sharing logic reentrant. Used a reference counting like scheme to allow nested uses. The error appeared after 8c775391b78b2a4a2b57c5e89ed4888f36aada4b. Backport of 76990cbbda5d93fda560c8a5ab019860f7efaab7 from master.
Diffstat (limited to 'tests/servers')
-rw-r--r--tests/servers/test_liveserverthread.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/servers/test_liveserverthread.py b/tests/servers/test_liveserverthread.py
index d39aac8183..9762b53791 100644
--- a/tests/servers/test_liveserverthread.py
+++ b/tests/servers/test_liveserverthread.py
@@ -18,11 +18,10 @@ class LiveServerThreadTest(TestCase):
# Pass a connection to the thread to check they are being closed.
connections_override = {DEFAULT_DB_ALIAS: conn}
- saved_sharing = conn.allow_thread_sharing
+ conn.inc_thread_sharing()
try:
- conn.allow_thread_sharing = True
self.assertTrue(conn.is_usable())
self.run_live_server_thread(connections_override)
self.assertFalse(conn.is_usable())
finally:
- conn.allow_thread_sharing = saved_sharing
+ conn.dec_thread_sharing()