Skip to content
Permalink
Browse files

Make compiled tests more stable

we do not want to ignore AttributeErrors for those
  • Loading branch information
m-kuhn committed May 31, 2018
1 parent dbe4186 commit d1eabe1c2b3babeddc3996a05c6261175596c250
@@ -52,6 +52,11 @@ def uncompiledFilters(self):
cannot be compiled """
return set()

def enableCompiler(self):
"""By default there is no expression compiling available, needs to be overridden in subclass"""
print('Provider does not support compiling')
return False

def partiallyCompiledFilters(self):
""" Individual derived provider tests should override this to return a list of expressions which
should be partially compiled """
@@ -141,14 +146,11 @@ def testGetFeaturesUncompiled(self):
self.runPolyGetFeatureTests(self.poly_provider)

def testGetFeaturesExp(self):
try:
self.enableCompiler()
if self.enableCompiler():
self.compiled = True
self.runGetFeatureTests(self.source)
if hasattr(self, 'poly_provider'):
self.runPolyGetFeatureTests(self.poly_provider)
except AttributeError:
print('Provider does not support compiling')

def testSubsetString(self):
if not self.source.supportsSubsetString():
@@ -232,11 +234,8 @@ def testOrderBy(self):
self.runOrderByTests()

def testOrderByCompiled(self):
try:
self.enableCompiler()
if self.enableCompiler():
self.runOrderByTests()
except AttributeError:
print('Provider does not support compiling')

def runOrderByTests(self):
FeatureSourceTestCase.runOrderByTests(self)
@@ -58,6 +58,7 @@ def getSubsetString(self):

def enableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', True)
return True

def disableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', False)
@@ -52,6 +52,7 @@ def tearDownClass(cls):

def enableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', True)
return True

def disableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', False)
@@ -85,6 +85,7 @@ def getEditableLayer(self):

def enableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', True)
return True

def disableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', False)
@@ -104,6 +104,7 @@ def getEditableLayer(self):

def enableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', True)
return True

def disableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', False)
@@ -1125,6 +1126,7 @@ def tearDownClass(cls):

def enableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', True)
return True

def disableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', False)
@@ -93,6 +93,7 @@ def getEditableLayer(self):

def enableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', True)
return True

def disableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', False)
@@ -260,6 +260,7 @@ def tearDown(self):

def enableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', True)
return True

def disableCompiler(self):
QgsSettings().setValue('/qgis/compileExpressions', False)

0 comments on commit d1eabe1

Please sign in to comment.
You can’t perform that action at this time.