Skip to content

Commit

Permalink
Fix F523 flake issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 12, 2020
1 parent 04699b0 commit e76013e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .ci/travis/scripts/pr_has_label.py
Expand Up @@ -23,7 +23,7 @@
try:
data = urlopen(url).read().decode('utf-8')
except URLError as err:
print("URLError: ".format(err.reason))
print("URLError: {}".format(err.reason))
sys.exit(1)

obj = json.loads(data)
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/processing/algs/grass7/ext/r_proj.py
Expand Up @@ -48,8 +48,7 @@ def processInputs(alg, parameters, context, feedback):

# Grab the projected Crs
crs = alg.parameterAsCrs(parameters, 'crs', context)
alg.commands.append('g.proj -c proj4="{}"'.format(
crs.toProj(), newLocation))
alg.commands.append('g.proj -c proj4="{}"'.format(crs.toProj()))

# Remove crs parameter
alg.removeParameter('crs')
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/processing/algs/grass7/ext/v_proj.py
Expand Up @@ -48,8 +48,7 @@ def processInputs(alg, parameters, context, feedback):

# Grab the projected Crs
crs = alg.parameterAsCrs(parameters, 'crs', context)
alg.commands.append('g.proj -c proj4="{}"'.format(
crs.toProj(), newLocation))
alg.commands.append('g.proj -c proj4="{}"'.format(crs.toProj()))

# Remove crs parameter
alg.removeParameter('crs')
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_provider_ogr_gpkg.py
Expand Up @@ -311,7 +311,7 @@ def testSelectSubsetString(self):

testdata_path = unitTestDataPath('provider')
shutil.copy(os.path.join(testdata_path, 'bug_19826.gpkg'), tmpfile)
vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile, 'test', 'ogr'))
vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile), 'test', 'ogr')
vl.setSubsetString("name = 'two'")
got = [feat for feat in vl.getFeatures()]
self.assertEqual(len(got), 1)
Expand Down Expand Up @@ -1327,7 +1327,7 @@ def testJson(self):
testdata_path = unitTestDataPath('provider')
shutil.copy(os.path.join(unitTestDataPath('provider'), 'test_json.gpkg'), tmpfile)

vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile, 'foo', 'ogr'))
vl = QgsVectorLayer('{}|layerid=0'.format(tmpfile), 'foo', 'ogr')
self.assertTrue(vl.isValid())

fields = vl.dataProvider().fields()
Expand Down
9 changes: 3 additions & 6 deletions tests/src/python/test_qgsunittypes.py
Expand Up @@ -513,8 +513,7 @@ def testFromUnitToUnitFactor(self):
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QgsUnitTypes.DistanceUnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, QgsUnitTypes.toString(from_unit)))

def testAreaFromUnitToUnitFactor(self):
"""Test calculation of conversion factor between areal units"""
Expand Down Expand Up @@ -689,8 +688,7 @@ def testAreaFromUnitToUnitFactor(self):
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QgsUnitTypes.AreaUnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, QgsUnitTypes.toString(from_unit)))

def testDistanceToAreaUnit(self):
"""Test distanceToAreaUnit conversion"""
Expand Down Expand Up @@ -1145,8 +1143,7 @@ def testAngleFromUnitToUnitFactor(self):
res = QgsUnitTypes.fromUnitToUnitFactor(from_unit, QgsUnitTypes.AngleUnknownUnit)
self.assertAlmostEqual(res,
1.0,
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, expected_factor,
QgsUnitTypes.toString(from_unit)))
msg='got {:.7f}, expected 1.0 when converting from {} to unknown units'.format(res, QgsUnitTypes.toString(from_unit)))

def testFormatAngle(self):
"""Test formatting angles"""
Expand Down

0 comments on commit e76013e

Please sign in to comment.