Skip to content
Permalink
Browse files

Fix locale problems in PyQgsAppStartup test

  • Loading branch information
m-kuhn committed Mar 29, 2016
1 parent 0cc7ae0 commit fbc2a4ee7a2ab19450d9c8d4395ebec14254f4c0
Showing with 9 additions and 2 deletions.
  1. +5 −1 src/python/qgspythonutilsimpl.cpp
  2. +4 −1 tests/src/python/test_qgsappstartup.py
@@ -82,7 +82,7 @@ bool QgsPythonUtilsImpl::checkSystemImports()
// locally installed plugins have priority over the system plugins
// use os.path.expanduser to support usernames with special characters (see #2512)
QStringList pluginpaths;
Q_FOREACH ( QString p, extraPluginsPaths() )
Q_FOREACH ( const QString& p, extraPluginsPaths() )
{
if ( !QDir( p ).exists() )
{
@@ -97,7 +97,11 @@ bool QgsPythonUtilsImpl::checkSystemImports()
// we store here paths in unicode strings
// the str constant will contain utf8 code (through runString)
// so we call '...'.decode('utf-8') to make a unicode string
#if (PY_VERSION_HEX < 0x03000000)
pluginpaths << '"' + p + "\".decode('utf-8')";
#else
pluginpaths << '"' + p + '"';
#endif
}
pluginpaths << homePluginsPath();
pluginpaths << '"' + pluginsPath() + '"';
@@ -23,6 +23,7 @@
import subprocess
import tempfile
import errno
import locale

from qgis.testing import unittest
from utilities import unitTestDataPath
@@ -118,6 +119,8 @@ def testPluginPath(self):
for t in ['test_plugins', 'test plugins', u'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
@@ -137,7 +140,7 @@ def testPluginPath(self):
testFile="plugin_started.txt",
timeOut=270,
loadPlugins=True,
env={'QGIS_PLUGINPATH': testDir.encode('ascii', 'ignore')})
env={'QGIS_PLUGINPATH': testDir})

def testPyQgisStartupEnvVar(self):
# verify PYQGIS_STARTUP env variable file is run by embedded interpreter

0 comments on commit fbc2a4e

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