MCPcopy
hub / github.com/django/django / test_thread_sharing_count

Method test_thread_sharing_count

tests/backends/tests.py:955–967  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

953 self.assertEqual(len(exceptions), 0)
954
955 def test_thread_sharing_count(self):
956 self.assertIs(connection.allow_thread_sharing, False)
957 connection.inc_thread_sharing()
958 self.assertIs(connection.allow_thread_sharing, True)
959 connection.inc_thread_sharing()
960 self.assertIs(connection.allow_thread_sharing, True)
961 connection.dec_thread_sharing()
962 self.assertIs(connection.allow_thread_sharing, True)
963 connection.dec_thread_sharing()
964 self.assertIs(connection.allow_thread_sharing, False)
965 msg = "Cannot decrement the thread sharing count below zero."
966 with self.assertRaisesMessage(RuntimeError, msg):
967 connection.dec_thread_sharing()
968
969
970class MySQLAutoPKZeroTests(TestCase):

Callers

nothing calls this directly

Calls 3

inc_thread_sharingMethod · 0.80
dec_thread_sharingMethod · 0.80
assertRaisesMessageMethod · 0.80

Tested by

no test coverage detected