本文整理汇总了Python中qgis.server.QgsServerSettings.maxThreads方法的典型用法代码示例。如果您正苦于以下问题:Python QgsServerSettings.maxThreads方法的具体用法?Python QgsServerSettings.maxThreads怎么用?Python QgsServerSettings.maxThreads使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.server.QgsServerSettings
的用法示例。
在下文中一共展示了QgsServerSettings.maxThreads方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestQgsServerSettings
# 需要导入模块: from qgis.server import QgsServerSettings [as 别名]
# 或者: from qgis.server.QgsServerSettings import maxThreads [as 别名]
class TestQgsServerSettings(unittest.TestCase):
def setUp(self):
self.settings = QgsServerSettings()
self.testdata_path = unitTestDataPath("qgis_server_settings")
def tearDown(self):
pass
def test_env_parallel_rendering(self):
env = "QGIS_SERVER_PARALLEL_RENDERING"
# test parallel rendering value from environment variable
os.environ[env] = "1"
self.settings.load()
self.assertTrue(self.settings.parallelRendering())
os.environ.pop(env)
os.environ[env] = "0"
self.settings.load()
self.assertFalse(self.settings.parallelRendering())
os.environ.pop(env)
def test_env_log_level(self):
env = "QGIS_SERVER_LOG_LEVEL"
# test log level value from environment variable
os.environ[env] = "3"
self.settings.load()
self.assertEqual(self.settings.logLevel(), 3)
os.environ.pop(env)
os.environ[env] = "1"
self.settings.load()
self.assertEqual(self.settings.logLevel(), 1)
os.environ.pop(env)
def test_env_log_file(self):
env = "QGIS_SERVER_LOG_FILE"
# test parallel rendering value from environment variable
os.environ[env] = "/tmp/qgisserv.log"
self.settings.load()
self.assertEqual(self.settings.logFile(), "/tmp/qgisserv.log")
os.environ.pop(env)
os.environ[env] = "/tmp/qserv.log"
self.settings.load()
self.assertEqual(self.settings.logFile(), "/tmp/qserv.log")
os.environ.pop(env)
def test_env_project_file(self):
env = "QGIS_PROJECT_FILE"
# test parallel rendering value from environment variable
os.environ[env] = "/tmp/myproject.qgs"
self.settings.load()
self.assertEqual(self.settings.projectFile(), "/tmp/myproject.qgs")
os.environ.pop(env)
os.environ[env] = "/tmp/myproject2.qgs"
self.settings.load()
self.assertEqual(self.settings.projectFile(), "/tmp/myproject2.qgs")
os.environ.pop(env)
def test_env_max_cache_layers(self):
env = "MAX_CACHE_LAYERS"
# test parallel rendering value from environment variable
os.environ[env] = "3"
self.settings.load()
self.assertEqual(self.settings.maxCacheLayers(), 3)
os.environ.pop(env)
os.environ[env] = "100"
self.settings.load()
self.assertEqual(self.settings.maxCacheLayers(), 100)
os.environ.pop(env)
def test_env_max_threads(self):
env = "QGIS_SERVER_MAX_THREADS"
# test parallel rendering value from environment variable
os.environ[env] = "3"
self.settings.load()
self.assertEqual(self.settings.maxThreads(), 3)
os.environ.pop(env)
os.environ[env] = "5"
self.settings.load()
self.assertEqual(self.settings.maxThreads(), 5)
os.environ.pop(env)
def test_env_cache_size(self):
env = "QGIS_SERVER_CACHE_SIZE"
self.assertEqual(self.settings.cacheSize(), 50 * 1024 * 1024)
os.environ[env] = "1024"
self.settings.load()
#.........这里部分代码省略.........