Skip to content

Commit

Permalink
Skip tests when TRAVIS=true and add an agnostic QGIS_CONTINUOUS_INTEG…
Browse files Browse the repository at this point in the history
…RATION_RUN
  • Loading branch information
elpaso authored and nyalldawson committed Feb 8, 2021
1 parent 7fb45b8 commit ccb6cb0
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .docker/docker-variables.env
Expand Up @@ -8,3 +8,8 @@ CTEST_BUILD_DIR=/root/QGIS

# Other var
QGIS_NO_OVERRIDE_IMPORT=1

# We were using TRAVIS=true to skip some tests
# let's keep it for now but also use a new var
QGIS_CONTINUOUS_INTEGRATION_RUN=true
TRAVIS=true
2 changes: 1 addition & 1 deletion tests/src/python/test_db_manager_gpkg.py
Expand Up @@ -139,7 +139,7 @@ def testListLayer(self):

connection.remove()

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Test flaky') # see https://travis-ci.org/qgis/QGIS/jobs/502556996
def testCreateRenameDeleteTable(self):
connection_name = 'testCreateRenameDeleteTable'
Expand Down
16 changes: 8 additions & 8 deletions tests/src/python/test_provider_mssql.py
Expand Up @@ -63,7 +63,7 @@ def setUpClass(cls):
cls.poly_provider = cls.poly_vl.dataProvider()

# Triggers a segfault in the sql server odbc driver on Travis - TODO test with more recent Ubuntu base image
if os.environ.get('TRAVIS', '') == 'true':
if os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'):
del cls.getEditableLayer

# Use connections API
Expand Down Expand Up @@ -215,22 +215,22 @@ def uncompiledFilters(self):
return filters

def testGetFeaturesUncompiled(self):
if os.environ.get('TRAVIS', '') == 'true':
if os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'):
return
super().testGetFeaturesUncompiled()

def testGetFeaturesExp(self):
if os.environ.get('TRAVIS', '') == 'true':
if os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'):
return
super().testGetFeaturesExp()

def testOrderBy(self):
if os.environ.get('TRAVIS', '') == 'true':
if os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'):
return
super().testOrderBy()

def testOrderByCompiled(self):
if os.environ.get('TRAVIS', '') == 'true':
if os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'):
return
super().testOrderByCompiled()

Expand Down Expand Up @@ -290,7 +290,7 @@ def testFloatDecimalFields(self):
self.assertIsInstance(f.attributes()[dec_idx], float)
self.assertEqual(f.attributes()[dec_idx], 1.123)

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Failing on Travis')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Failing on Travis')
def testCreateLayer(self):
layer = QgsVectorLayer("Point?field=id:integer&field=fldtxt:string&field=fldint:integer",
"addfeat", "memory")
Expand Down Expand Up @@ -326,7 +326,7 @@ def testCreateLayer(self):
geom = [f.geometry().asWkt() for f in new_layer.getFeatures()]
self.assertEqual(geom, ['Point (1 2)', '', 'Point (3 2)', 'Point (4 3)'])

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Failing on Travis')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Failing on Travis')
def testCreateLayerMultiPoint(self):
layer = QgsVectorLayer("MultiPoint?crs=epsg:3111&field=id:integer&field=fldtxt:string&field=fldint:integer",
"addfeat", "memory")
Expand Down Expand Up @@ -359,7 +359,7 @@ def testCreateLayerMultiPoint(self):
geom = [f.geometry().asWkt() for f in new_layer.getFeatures()]
self.assertEqual(geom, ['MultiPoint ((1 2),(3 4))', '', 'MultiPoint ((7 8))'])

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Failing on Travis')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Failing on Travis')
def testCurveGeometries(self):
geomtypes = ['CompoundCurveM', 'CurvePolygonM', 'CircularStringM', 'CompoundCurveZM', 'CurvePolygonZM',
'CircularStringZM', 'CompoundCurveZ', 'CurvePolygonZ', 'CircularStringZ', 'CompoundCurve',
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_provider_postgres.py
Expand Up @@ -2384,7 +2384,7 @@ def testIdentityPk(self):
feature = next(vl.getFeatures())
self.assertIsNotNone(feature.id())

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test flaky')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Test flaky')
def testDefaultValuesAndClauses(self):
"""Test whether default values like CURRENT_TIMESTAMP or
now() they are respected. See GH #33383"""
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsactionmanager.py
Expand Up @@ -154,7 +154,7 @@ def check_action_result(self, temp_file):
return output

@unittest.expectedFailure(platform.system() != 'Linux')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test is flaky on Travis environment')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Test is flaky on Travis environment')
def testDoAction(self):
""" test running action """

Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgscoordinateoperationwidget.py
Expand Up @@ -116,7 +116,7 @@ def testOperations(self):
self.assertFalse(w.selectedOperation().allowFallback)
self.assertEqual(len(spy), 8)

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or QgsProjUtils.projVersionMajor() >= 6, 'Depends on local environment and grid presence')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true') or QgsProjUtils.projVersionMajor() >= 6, 'Depends on local environment and grid presence')
def testOperationsCruftyProj(self):
w = QgsCoordinateOperationWidget()
self.assertFalse(w.hasSelection())
Expand Down
8 changes: 4 additions & 4 deletions tests/src/python/test_qgsfiledownloader.py
Expand Up @@ -53,7 +53,7 @@ def _make_download(self, url, destination, cancel=False):

loop.exec_()

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Test with http://www.qgis.org unstable. Needs local server.')
def test_validDownload(self):
"""Tests a valid download"""
Expand All @@ -79,7 +79,7 @@ def test_inValidDownload(self):
self.assertEqual(self.error_args[1], [u'Download failed: Host www.doesnotexistofthatimsure.qgis not found'])
self.assertFalse(os.path.isfile(destination))

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Test with http://www.github.com unstable. Needs local server.')
def test_dowloadCanceled(self):
"""Tests user canceled download"""
Expand All @@ -101,7 +101,7 @@ def test_InvalidUrl(self):
self.assertFalse(os.path.isfile(destination))
self.assertEqual(self.error_args[1], [u"Download failed: Protocol \"xyz\" is unknown"])

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Test with http://www.github.com unstable. Needs local server.')
def test_InvalidFile(self):
self._make_download('https://github.com/qgis/QGIS/archive/master.zip', "")
Expand Down Expand Up @@ -134,7 +134,7 @@ def ssl_compare(self, name, url, error):
result = ';'.join(result)
self.assertTrue(result.startswith(error), msg + "expected:\n%s\nactual:\n%s\n" % (result, error))

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test with badssl.com unstable. Needs local server.')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Test with badssl.com unstable. Needs local server.')
def test_sslExpired(self):
self.ssl_compare("expired", "https://expired.badssl.com/", "SSL Errors: ;The certificate has expired")
self.ssl_compare("self-signed", "https://self-signed.badssl.com/",
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgslabellinesettings.py
Expand Up @@ -30,7 +30,7 @@

class TestQgsLabelLineSettings(unittest.TestCase):

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Python version too old for enum classes to work')
def test_line_settings(self):
"""
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_line_settings(self):
self.assertTrue(pal_settings.lineSettings().overrunDistanceMapUnitScale().minScale, 1)
self.assertTrue(pal_settings.lineSettings().overrunDistanceMapUnitScale().maxScale, 2)

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Python version too old for enum classes to work')
def testUpdateDataDefinedProps(self):
settings = QgsLabelLineSettings()
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsproviderconnection_postgres.py
Expand Up @@ -293,7 +293,7 @@ def test_foreign_table_csv(self):

self.assertNotEquals(conn.tables('public', QgsAbstractDatabaseProviderConnection.Foreign | QgsAbstractDatabaseProviderConnection.Aspatial), [])

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Disabled on Travis')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Disabled on Travis')
def test_foreign_table_server(self):
"""Test foreign table with server"""

Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsqueryresultmodel.py
Expand Up @@ -113,7 +113,7 @@ def loop_exiter():

self.assertTrue(res.fetchedRowCount() > 0 and res.fetchedRowCount() < self.NUM_RECORDS)

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Local manual test: not for CI')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Local manual test: not for CI')
def test_widget(self):
"""Manual local GUI test for the model"""

Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsserver_wms_getfeatureinfo.py
Expand Up @@ -866,7 +866,7 @@ def testGetFeatureInfoJsonUseIdAsLayerName(self):
'test_project_use_layer_ids.qgs',
normalizeJson=True)

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
"This test cannot run in TRAVIS because it relies on cascading external services")
def testGetFeatureInfoCascadingLayers(self):
"""Test that we can get feature info on cascading WMS layers"""
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsserver_wms_getmap.py
Expand Up @@ -1635,7 +1635,7 @@ def test_wms_getmap_datasource_error(self):

self.assertTrue('ServerException' in str(r))

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Can\'t rely on external resources for continuous integration')
def test_wms_getmap_external(self):
# 1 bits
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsserver_wms_getprint.py
Expand Up @@ -329,7 +329,7 @@ def test_wms_getprint_two_maps(self):
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetPrint_TwoMaps")

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true',
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'),
'Can\'t rely on external resources for continuous integration')
def test_wms_getprint_external(self):
qs = "?" + "&".join(["%s=%s" % i for i in list({
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgstaskmanager.py
Expand Up @@ -262,7 +262,7 @@ def finished_multiple_value_result(e, results):
self.assertEqual(result_value, 5)
self.assertEqual(result_statement, 'whoo')

@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test is unstable on Travis')
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true' or os.environ.get('QGIS_CONTINUOUS_INTEGRATION_RUN', 'true'), 'Test is unstable on Travis')
def testTaskFromFunctionWithSubTaskCompletedIsCalledOnce(self): # spellok
""" test that when a parent task has subtasks it does emit taskCompleted only once"""

Expand Down

0 comments on commit ccb6cb0

Please sign in to comment.