Skip to content

Commit

Permalink
Remove concurrency test from pg
Browse files Browse the repository at this point in the history
 it has been added to providerbase
  • Loading branch information
m-kuhn authored Aug 9, 2018
1 parent e5fce1e commit 1668754
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions tests/src/python/test_provider_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,32 +1141,6 @@ def testCurveToMultipolygon(self):
self.assertEqual(g.childCount(), 1)
self.assertTrue(g.childGeometry(0).vertexCount() > 3)

def testConcurrency(self):
"""
The connection pool has a maximum of 4 connections defined (+2 spare connections)
Make sure that if we exhaust those 4 connections and force another connection
it is actually using the spare connections and does not freeze.
This situation normally happens when (at least) 4 rendering threads are active
in parallel and one requires an expression to be evaluated.
"""
vl = QgsVectorLayer('{conn} srid=4326 table="qgis_test".{table} (geom) sql='.format(conn=self.dbconn, table='someData'), "testgeom", "postgres")
self.assertTrue(vl.isValid())
QgsProject.instance().addMapLayer(vl)

# Acquire the maximum amount of concurrent connections
iterators = list()
for i in range(QgsApplication.instance().maxConcurrentConnectionsPerPool()):
iterators.append(vl.getFeatures())

# Run an expression that will also do a request and should use a spare
# connection. It just should not deadlock here.

feat = next(it)
context = QgsExpressionContext()
context.setFeature(feat)
exp = QgsExpression('get_feature(\'{layer}\', \'pk\', 5)'.format(layer=vl.id()))
exp.evaluate(context)


class TestPyQgsPostgresProviderCompoundKey(unittest.TestCase, ProviderTestCase):

Expand Down

0 comments on commit 1668754

Please sign in to comment.