Class: QgsTestUtils

List of all members, including inherited members

Constructor

__init__

Static Methods

compareDomElements

Compares two DOM elements and returns True if they are equivalent.

sanitizeFakeHttpEndpoint

Sanitizes fake_qgis_http_endpoint URLs

testConcurrentLayerAccess

Runs a concurrent access stress test on the layer uri from the provider providerKey, by concurrently opening, reading and closing vector layers and querying the sublayers of the URI from multiple threads for runTimeMs milliseconds.

testProviderIteratorThreadSafety

Runs a thready safety test on iterators from a vector data provider, by concurrently requesting features from the provider.

class qgis.core.QgsTestUtils[source]
class qgis.core.QgsTestUtils(a0: QgsTestUtils)

Bases: object

static compareDomElements(element1: QDomElement, element2: QDomElement) → bool[source]

Compares two DOM elements and returns True if they are equivalent.

Dumps useful diff information to the console if the elements differ.

Parameters:
  • element1 (QDomElement)

  • element2 (QDomElement)

Return type:

bool

static sanitizeFakeHttpEndpoint(urlString: str | None) → str[source]

Sanitizes fake_qgis_http_endpoint URLs

Parameters:

urlString (str|None)

Return type:

str

static testConcurrentLayerAccess(uri: str | None, providerKey: str | None, runTimeMs: int = 2000, timeoutMs: int = 60000) → bool[source]

Runs a concurrent access stress test on the layer uri from the provider providerKey, by concurrently opening, reading and closing vector layers and querying the sublayers of the URI from multiple threads for runTimeMs milliseconds.

Returns False if any of the involved threads failed to finish within timeoutMs milliseconds (i.e. a deadlock occurred), or if the concurrent layer opens and sublayer queries did not return the same results as when performed from a single thread.

Parameters:
  • uri (str|None)

  • providerKey (str|None)

  • runTimeMs (int = 2000)

  • timeoutMs (int = 60000)

Return type:

bool

static testProviderIteratorThreadSafety(provider: QgsVectorDataProvider | None, request: QgsFeatureRequest = QgsFeatureRequest()) → bool[source]

Runs a thready safety test on iterators from a vector data provider, by concurrently requesting features from the provider.

This method returns True… or it segfaults.

Parameters:
Return type:

bool