Skip to content

Commit

Permalink
remove python version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 3, 2017
1 parent 3244634 commit 96c31a1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ def spatialite_connect(*args, **kwargs):
def _import(name, globals={}, locals={}, fromlist=[], level=None):
""" wrapper around builtin import that keeps track of loaded plugin modules """
if level is None:
level = -1 if sys.version_info[0] < 3 else 0
level = 0
mod = _builtin_import(name, globals, locals, fromlist, level)

if mod and '__file__' in mod.__dict__:
Expand Down
2 changes: 0 additions & 2 deletions tests/src/python/test_qgsappstartup.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ def testPluginPath(self):
for t in ['test_plugins', 'test plugins', 'test_pluginsé€']:

# get a unicode test dir
if sys.version_info.major == 2:
t = t.encode(locale.getpreferredencoding())
testDir = os.path.join(self.TMP_DIR, t)

# copy from testdata
Expand Down
10 changes: 2 additions & 8 deletions tests/src/python/test_qgsdelimitedtextprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ def __exit__(self, type, value, traceback):

def logMessage(self, msg, tag, level):
if tag == self.tag or not self.tag:
if sys.version_info.major == 2:
self.log.append(str(msg))
else:
self.log.append(str(msg))
self.log.append(str(msg))

def messages(self):
return self.log
Expand Down Expand Up @@ -240,10 +237,7 @@ def layerData(self, layer, request={}, offset=0):
for field in f.fields():
fields.append(str(field.name()))
fieldTypes.append(str(field.typeName()))
if sys.version_info.major == 2:
fielddata = dict((name, str(f[name])) for name in fields)
else:
fielddata = dict((name, str(f[name])) for name in fields)
fielddata = dict((name, str(f[name])) for name in fields)
g = f.geometry()
if not g.isNull():
fielddata[geomkey] = str(g.exportToWkt())
Expand Down
5 changes: 1 addition & 4 deletions tests/src/python/test_qgsvirtuallayerdefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@


def strToUrl(s):
if sys.version_info.major == 3:
return QUrl.fromEncoded(bytes(s, "utf8"))
else:
return QUrl.fromEncoded(s)
return QUrl.fromEncoded(bytes(s, "utf8"))


class TestQgsVirtualLayerDefinition(unittest.TestCase):
Expand Down

0 comments on commit 96c31a1

Please sign in to comment.