Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Make nested iterator request test solid for max conn count changes
- Loading branch information
Showing
with
9 additions
and
4 deletions.
-
+9
−4
tests/src/python/test_provider_postgres.py
|
@@ -1153,11 +1153,16 @@ def testConcurrency(self): |
|
|
""" |
|
|
vl = QgsVectorLayer('{conn} srid=4326 table="qgis_test".{table} (geom) sql='.format(conn=self.dbconn, table='someData'), "testgeom", "postgres") |
|
|
self.assertTrue(vl.isValid()) |
|
|
it = vl.getFeatures() |
|
|
it2 = vl.getFeatures() |
|
|
it3 = vl.getFeatures() |
|
|
it4 = vl.getFeatures() |
|
|
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) |
|
|